Theme
Default colors/fonts/spacing for BGE.UI widgets. Game.defaultTheme is the engine-wide default (matching today's previously-hardcoded widget colors, so existing consumers see no visual change); a UiContainer.theme overrides it for that container's subtree.
Resolution happens on every draw() call, not once at add-time: a widget resolves the theme from its immediate parent's effectiveTheme() (which itself falls back to Game.defaultTheme when that parent has no theme set), and any per-widget color field left invalid picks up the theme's value. There is no multi-level walk up the tree - only the immediate parent is consulted, so a grandparent container's own override does not reach a grandchild through an intervening container that has no theme of its own.
font, when set, is applied once to a widget's rendered text - see UiWidget.applyThemeFont(), called from every widget that owns a BGE.DrawableText (Button, Label, Checkbox, Slider, Select, TextInput) right after resolveTheme() in its own draw(). This is a one-time application per widget (not dynamic font-swapping): re-applying on every theme change would mean detecting whether font changed, which can't be done by comparing roFont instances (= on native components is a runtime crash in BrightScript, confirmed for roFont specifically - even a cast as object doesn't avoid it). fontSize is still accepted and stored but not applied - a roFont from Game.loadFont()/GetFont() already has its size baked in at load time, so this field is effectively vestigial.
Properties
backgroundColor(integer)foregroundColor(integer)borderColor(integer)focusedBorderColor(integer)hoveredBackgroundColor(integer)disabledColor(integer)font(roFont)fontSize(integer)defaultPadding(OffsetSize)defaultMargin(OffsetSize)cursorColor(integer)cursorSize(float)backgroundImage(dynamic) — A background image, drawn instead of a flat backgroundColor fill when ' set. invalid (the default) means "flat color" - exactly today's ' behavior, so this is purely additive. Either a BGE.UI.NinePatchImage ' (a stretchable image with unstretched corners) or a BGE.UI.ImageBackground ' (a plain image, stretched to fill entirely) - see ' BGE.UI.loadBackgroundImage(), which picks the right one automatically ' from the asset's filename. Does not vary by hover/focus state - a ' themeable hovered/focused background image is a possible future ' follow-up, not supported here.
Constructor
new Theme(): Theme