Style

structure Style

This object represents the style of a widget. Styles can be either changed directly on a Widget, or changed on the GUI:SKIN so as to affect all subsequently created widgets of a particular type inside that GUI.

Suffix

Type

Description

HSTRETCH

Boolean

Should the widget stretch horizontally? (default depends on widget subclass)

VSTRETCH

Boolean

Should the widget stretch vertically?

WIDTH

Scalar (pixels)

Fixed width (or 0 if flexible).

HEIGHT

Scalar (pixels)

Fixed height (or 0 if flexible).

MARGIN

StyleRectOffset

Spacing between this and other widgets.

PADDING

StyleRectOffset

Spacing between the outside of the widget and its contents (text, etc.).

BORDER

StyleRectOffset

Size of the edges in the 9-slice image for BG images in NORMAL, HOVER, etc.

OVERFLOW

StyleRectOffset

Extra space added to the area of the background image. Allows the background to go beyond the widget’s rectangle.

ALIGN

String

One of “CENTER”, “LEFT”, or “RIGHT”. See note below.

FONT

String

The name of the font of the text on the content or “” if the default.

FONTSIZE

Scalar

The size of the text on the content.

RICHTEXT

Boolean

Set to False to disable rich-text (<i>…</i>, etc.)

NORMAL

StyleState

Properties for the widget normally.

ON

StyleState

Properties for when the widget is under the mouse and “on”.

NORMAL_ON

StyleState

Alias for ON.

HOVER

StyleState

Properties for when the widget is under the mouse.

HOVER_ON

StyleState

Properties for when the widget is under the mouse and “on”.

ACTIVE

StyleState

Properties for when the widget is active (eg. button being held down).

ACTIVE_ON

StyleState

Properties for when the widget is active and “on”.

FOCUSED

StyleState

Properties for when the widget has keyboard focus.

FOCUSED_ON

StyleState

Properties for when the widget has keyboard focus and is “on”.

BG

String

The same as NORMAL:BG. Name of a “9-slice” image file.

TEXTCOLOR

Color

The same as NORMAL:TEXTCOLOR. The color of the text on the label.

WORDWRAP

Boolean

Can labels be broken into multiple lines on word boundaries?

Style:HSTRETCH
Type

Boolean

Access

Get/Set

Should the widget stretch horizontally? (default depends on widget subclass)

Style:VSTRETCH
Type

Boolean

Access

Get/Set

Should the widget stretch vertically?

Style:WIDTH
Type

Scalar

Access

Get/Set

(pixels) Fixed width (or 0 if flexible).

Style:HEIGHT
Type

Scalar

Access

Get/Set

(pixels) Fixed height (or 0 if flexible).

Style:MARGIN
Type

StyleRectOffset

Access

Get/Set

Spacing between this and other widgets.

Style:PADDING
Type

StyleRectOffset

Access

Get/Set

Spacing between the outside of the widget and its contents (text, etc.).

Style:BORDER
Type

StyleRectOffset

Access

Get/Set

Size of the edges in the 9-slice image for BG images in NORMAL, HOVER, etc.

Style:OVERFLOW
Type

StyleRectOffset

Access

Get/Set

Extra space added to the area of the background image. Allows the background to go beyond the widget’s rectangle.

Style:ALIGN
Type

String

Access

Get/Set

One of “CENTER”, “LEFT”, or “RIGHT”.

Note

The ALIGN attribute will not do anything useful unless either HSTRETCH is set to true or a fixed WIDTH is set, since otherwise it will be exactly the right size to fit the content of the widget with no alignment within that space being necessary.

It is currently only relevant for the widgets that have scalar content (Label and subclasses).

Style:FONT
Type

String

Access

Get/Set

The name of the font of the text on the content or “” if the default. If you want to see the list of available font names, you can do so with List Fonts.. Please note that just because you see a font in that list on your computer, that doesn’t always mean that same font will exist on someone else’s computer. KSP ships with a few fonts that it does universally put on all platform installs, but other fonts in that list might be installed locally on your computer only by other mods (like kOS itself, which loads all your monospaced fonts for optional use as the terminal font). Fonts that we know KSP itself tends to install are: Arial, CALIBRI, HEADINGFONT, calibri, calibrib, calibriz, calibril, and dotty

Style:FONTSIZE
Type

Scalar

Access

Get/Set

The size of the text on the content.

Style:RICHTEXT
Type

Boolean

Access

Get/Set

Set to False to disable rich-text (<i>…</i>, etc.)

Style:NORMAL
Type

StyleState

Access

Get/Set

Properties for the widget normally.

Style:ON
Type

StyleState

Access

Get/Set

Properties for when the widget is under the mouse and “on”.

Style:NORMAL_ON
Type

StyleState

Access

Get/Set

Alias for ON.

Style:HOVER
Type

StyleState

Access

Get/Set

Properties for when the widget is under the mouse.

Style:HOVER_ON
Type

StyleState

Access

Get/Set

Properties for when the widget is under the mouse and “on”.

Style:ACTIVE
Type

StyleState

Access

Get/Set

Properties for when the widget is active (eg. button being held down).

Style:ACTIVE_ON
Type

StyleState

Access

Get/Set

Properties for when the widget is active and “on”.

Style:FOCUSED
Type

StyleState

Access

Get/Set

Properties for when the widget has keyboard focus.

Style:FOCUSED_ON
Type

StyleState

Access

Get/Set

Properties for when the widget has keyboard focus and is “on”.

Style:BG
Type

String

Access

Get/Set

The same as NORMAL:BG. Name of a “9-slice” image file.

Style:TEXTCOLOR
Type

color

The same as NORMAL:TEXTCOLOR. The color of the text on the label.

Style:WORDWRAP
Type

Boolean

Access

Get/Set

Can labels be broken into multiple lines on word boundaries?