theme

package
v0.5.53 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	TouchTargetAndroid = float32(48)
	TouchTargetIOS     = float32(44)
)

Android's own floor is 48dp; iOS's is 44pt. Both are published numbers, and they are the reason this is a metric rather than a constant.

Variables

View Source
var (
	BorderStrokeWidth    = float32(1.0) // Standard widget borders (FlatLaf: crisp 1px outlines)
	FocusStrokeWidth     = float32(1.5) // Focus rings
	CheckStrokeWidth     = float32(2.0) // Checkbox checkmarks
	SeparatorStrokeWidth = float32(1.0) // Separators/dividers
	CursorStrokeWidth    = float32(2.0) // Cursor strokes
)

Border stroke width system defaults (variables so they can be overridden)

View Source
var DefaultButtonTheme = &ButtonTheme{
	BackgroundInk:     graphics.Color(0xFF4F566D),
	BackgroundHover:   graphics.Color(0xFF565D75),
	BackgroundPressed: graphics.Color(0xFF454B60),
	BackgroundActive:  graphics.Color(0xFF5064A1),
	EdgeInk:           graphics.Color(0xFF6272A4),
	TextInk:           graphics.Color(0xFFC3C6C6),
	TextActive:        graphics.Color(0xFFFFFFFF),
	TextDisabled:      graphics.Color(0xFF6F737A),
	CornerRadius:      4,
	HMargin:           8,
	VMargin:           3,
	Font:              nil,
}
View Source
var DefaultCalendarTheme = &CalendarTheme{
	BackgroundInk:    graphics.Color(0xFF3A3D4C),
	BackgroundActive: graphics.Color(0xFF414450),
	BackgroundHover:  graphics.Color(0xFF4A4F60),
	EdgeInk:          graphics.Color(0xFF6272A4),
	TextInk:          graphics.Color(0xFFC3C6C6),
	TextActive:       graphics.Color(0xFFFFFFFF),
	TextHover:        graphics.Color(0xFFFFFFFF),
	CornerRadius:     0,
	HMargin:          10,
	VMargin:          6,
	TabHeight:        24,
	CloseSize:        12,
	Font:             nil,
}

CalendarTheme defines the visual style for Calendar widgets.

View Source
var DefaultCheckBoxTheme = &CheckBoxTheme{
	BackgroundInk:   graphics.Color(0xFF3A3D4C),
	BackgroundHover: graphics.Color(0xFF454B60),
	EdgeInk:         graphics.Color(0xFF6272A4),
	EdgeFocused:     graphics.Color(0xFF8A9CC8),
	SelectionInk:    graphics.Color(0xFF5064A1),
	TextInk:         graphics.Color(0xFFC3C6C6),
	TextDisabled:    graphics.Color(0xFF6F737A),
	BoxSize:         16,
	BoxSpacing:      6,
	CornerRadius:    3,
	Font:            nil,
}
View Source
var DefaultColorPickerTheme = &ColorPickerTheme{
	BackgroundInk:    graphics.Color(0xFF3A3D4C),
	BackgroundActive: graphics.Color(0xFF414450),
	BackgroundHover:  graphics.Color(0xFF4A4F60),
	EdgeInk:          graphics.Color(0xFF6272A4),
	TextInk:          graphics.Color(0xFFC3C6C6),
	TextActive:       graphics.Color(0xFFFFFFFF),
	TextHover:        graphics.Color(0xFFFFFFFF),
	CornerRadius:     0,
	HMargin:          10,
	VMargin:          6,
	TabHeight:        24,
	CloseSize:        12,
	Font:             nil,
}

ColorPickerTheme defines the visual style for ColorPicker widgets.

View Source
var DefaultComboBoxTheme = &ComboBoxTheme{
	BackgroundInk: graphics.Color(0xFF3A3D4C),
	EdgeInk:       graphics.Color(0xFF6272A4),
	TextInk:       graphics.Color(0xFFC3C6C6),
	TextDisabled:  graphics.Color(0xFF6F737A),
	ArrowInk:      graphics.Color(0xFF9AA0B5),
	HoverInk:      graphics.Color(0x334F566D),
	SelectedInk:   graphics.Color(0x445064A1),
	OptionHeight:  24,
	ArrowSize:     10,
	Font:          nil,
}
View Source
var DefaultContextMenuTheme = &ContextMenuTheme{
	BackgroundInk: graphics.Color(0xFF414450),
	EdgeInk:       graphics.Color(0xFF6272A4),
	TextInk:       graphics.Color(0xFFC3C6C6),
	TextDisabled:  graphics.Color(0xFF6F737A),
	ArrowInk:      graphics.Color(0xFF9AA0B5),
	HoverInk:      graphics.Color(0x334F566D),
	SelectedInk:   graphics.Color(0x445064A1),
	SeparatorInk:  graphics.Color(0xFF4B5163),
	OptionHeight:  24,
	ArrowSize:     10,
	Font:          nil,
}

ContextMenuTheme defines the visual style for ContextMenu widgets.

View Source
var DefaultGroupBoxTheme = &GroupBoxTheme{
	TextInk:       graphics.Color(0xFFC3C6C6),
	TextSecondary: graphics.Color(0xFF8A919E),
	Font:          nil,
}

GroupBoxTheme defines the visual style for GroupBox widgets.

View Source
var DefaultInputDialogTheme = &InputDialogTheme{
	BackgroundInk:    graphics.Color(0xFF414450),
	EdgeInk:          graphics.Color(0xFF6272A4),
	TitleBgInk:       graphics.Color(0xFF454B60),
	TitleTextInk:     graphics.Color(0xFFFFFFFF),
	DividerInk:       graphics.Color(0xFF4B5163),
	LabelTextInk:     graphics.Color(0xFFC3C6C6),
	InputBgInk:       graphics.Color(0xFF3A3D4C),
	InputBgFocused:   graphics.Color(0xFF414863),
	InputEdgeInk:     graphics.Color(0xFF6272A4),
	InputEdgeFocused: graphics.Color(0xFF8A9CC8),
	InputTextInk:     graphics.Color(0xFFFFFFFF),
	CursorInk:        graphics.Color(0xFFFFFFFF),
	ButtonBgInk:      graphics.Color(0xFF4F566D),
	ButtonEdgeInk:    graphics.Color(0xFF6272A4),
	ButtonTextInk:    graphics.Color(0xFFFFFFFF),
	Font:             nil,
}
View Source
var DefaultLabelTheme = &LabelTheme{
	TextInk:       graphics.Color(0xFFC3C6C6),
	TextSecondary: graphics.Color(0xFF8A919E),
	Font:          nil,
}
View Source
var DefaultListViewTheme = &ListViewTheme{
	BackgroundInk:   graphics.Color(0xFF3A3D4C),
	EdgeInk:         graphics.Color(0xFF6272A4),
	TextInk:         graphics.Color(0xFFFFFFFF),
	SelectedInk:     graphics.Color(0x445064A1),
	HoverInk:        graphics.Color(0x334F566D),
	AlternateRowInk: graphics.Color(0x11FFFFFF),
	Font:            nil,
}
View Source
var DefaultMarkdownTheme = &MarkdownTheme{

	Background:      graphics.Color(0x00000000),
	TextInk:         graphics.Color(0xFFD4D4D4),
	HeadingInk:      []graphics.Color{0xFFE8E8E8, 0xFFE8E8E8, 0xFFE0E0E0, 0xFFD8D8D8, 0xFFD0D0D0, 0xFFCCCCCC},
	ListMarkerInk:   graphics.Color(0xFF888888),
	QuoteInk:        graphics.Color(0xFF569CD6),
	QuoteBackground: graphics.Color(0x00000000),
	LinkInk:         graphics.Color(0xFF569CD6),

	CodeTextInk:          graphics.Color(0xFFD4D4D4),
	CodeBackground:       graphics.Color(0xFF1E1E1E),
	CodeLabelInk:         graphics.Color(0xFF888888),
	InlineCodeInk:        graphics.Color(0xFFD4D4D4),
	InlineCodeBackground: graphics.Color(0xFF2A2A2A),

	TableHeaderInk:         graphics.Color(0xFFE8E8E8),
	TableHeaderBackground:  graphics.Color(0xFF2A2A3A),
	TableRowEvenBackground: graphics.Color(0xFF1E1E1E),
	TableRowOddBackground:  graphics.Color(0xFF222222),
	TableBorderInk:         graphics.Color(0xFF3A3A3A),
	TableHeaderRuleInk:     graphics.Color(0xFF555555),
	TableCellPadX:          8,
	TableCellPadY:          4,
	TableRowMinHeight:      20,

	RuleInk:                  graphics.Color(0xFF555555),
	TaskDoneInk:              graphics.Color(0xFF6A9955),
	TaskTodoInk:              graphics.Color(0xFF888888),
	SearchHighlightInk:       graphics.Color(0x445064A1),
	SearchHighlightStrongInk: graphics.Color(0x59F1FA8C),

	CodePadX:      10,
	CodePadY:      8,
	BlockGap:      8,
	QuoteBarWidth: 3,
	QuotePadX:     10,
	HeadingSizes:  []float32{32, 24, 20, 16, 14, 12},
}

DefaultMarkdownTheme is the DARK renderer palette, kept close to what the renderer used to hardcode so the first themed render is a small change rather than a new look.

View Source
var DefaultMdiTheme = &MdiTheme{
	ContainerBgInk:   graphics.Color(0xFF1A1A1A),
	TabBgInk:         graphics.Color(0xFF333333),
	TabActiveBgInk:   graphics.Color(0xFF2D2D2D),
	TabEdgeInk:       graphics.Color(0xFF444444),
	TabTextInk:       graphics.Color(0xFF999999),
	TabActiveTextInk: graphics.Color(0xFFFFFFFF),
	TaskbarBgInk:     graphics.Color(0xFF3A3A3A),
	TaskbarTextInk:   graphics.Color(0xFF888888),
	TaskbarActiveInk: graphics.Color(0xFF4FC3F7),
	TaskbarBtnBgInk:  graphics.Color(0xFF3A3A3A),
	TaskbarBtnHover:  graphics.Color(0xFF2A2A2A),
	TaskbarBtnEdge:   graphics.Color(0xFF555555),
	DockBgInk:        graphics.Color(0xFF222222),
	DockEdgeInk:      graphics.Color(0xFF3A3A3A),
	DockSplitInk:     graphics.Color(0xFF4A4A4A),
	WinTitleBgInk:    graphics.Color(0xFF3A3A3A),
	WinTitleInactive: graphics.Color(0xFF2D2D2D),
	WinTitleEdgeInk:  graphics.Color(0xFF444444),
	WinTitleTextInk:  graphics.Color(0xFFE0E0E0),
	WinEdgeInk:       graphics.Color(0xFF555555),
	WinContentBgInk:  graphics.Color(0xFF1E1E1E),
	WinAccentInk:     graphics.Color(0xFF4FC3F7),
	WinTextSecondary: graphics.Color(0xFF888888),
	WinShadowInk:     graphics.Color(0x40000000),
	Font:             nil,
}
View Source
var DefaultMenuBarTheme = &MenuBarTheme{
	BackgroundInk:    graphics.Color(0xFF414450),
	BackgroundHover:  graphics.Color(0xFF565D75),
	BackgroundActive: graphics.Color(0xFF5064A1),
	TextInk:          graphics.Color(0xFFC3C6C6),
	TextActive:       graphics.Color(0xFFFFFFFF),
	TextSecondary:    graphics.Color(0xFF8A919E),
	EdgeInk:          graphics.Color(0xFF6272A4),
	Font:             nil,
}
View Source
var DefaultMessageBoxTheme = &MessageBoxTheme{
	BackgroundInk: graphics.Color(0xFF414450),
	EdgeInk:       graphics.Color(0xFF6272A4),
	TitleBgInk:    graphics.Color(0xFF454B60),
	TitleTextInk:  graphics.Color(0xFFFFFFFF),
	DividerInk:    graphics.Color(0xFF4B5163),
	BodyTextInk:   graphics.Color(0xFFC3C6C6),
	ButtonBgInk:   graphics.Color(0xFF4F566D),
	ButtonEdgeInk: graphics.Color(0xFF6272A4),
	ButtonTextInk: graphics.Color(0xFFFFFFFF),
	Font:          nil,
}
View Source
var DefaultPopupTheme = &PopupTheme{
	BackgroundInk:  graphics.Color(0xFF414450),
	EdgeInk:        graphics.Color(0xFF6272A4),
	TitleBgInk:     graphics.Color(0xFF454B60),
	TitleTextInk:   graphics.Color(0xFFFFFFFF),
	DividerInk:     graphics.Color(0xFF4B5163),
	HeadingTextInk: graphics.Color(0xFFFFFFFF),
	ShadowInk:      graphics.Color(0x60000000),
	Font:           nil,
}
View Source
var DefaultProgressBarTheme = &ProgressBarTheme{
	TrackInk:     graphics.Color(0xFF3A3D4C),
	FillInk:      graphics.Color(0xFF5064A1),
	EdgeInk:      graphics.Color(0xFF6272A4),
	CornerRadius: 4,
	Height:       6,
}
View Source
var DefaultRadioButtonTheme = &RadioButtonTheme{
	BackgroundInk:   graphics.Color(0xFF3A3D4C),
	BackgroundHover: graphics.Color(0xFF454B60),
	EdgeInk:         graphics.Color(0xFF6272A4),
	EdgeFocused:     graphics.Color(0xFF8A9CC8),
	SelectionInk:    graphics.Color(0xFF5064A1),
	TextInk:         graphics.Color(0xFFC3C6C6),
	TextDisabled:    graphics.Color(0xFF6F737A),
	BoxSize:         16,
	BoxSpacing:      6,
	Font:            nil,
}
View Source
var DefaultScrollBarTheme = &ScrollBarTheme{
	TrackInk:   graphics.Color(0xFF3A3D4C),
	ThumbInk:   graphics.Color(0xFF5A6480),
	ThumbHover: graphics.Color(0xFF6A7590),
	EdgeInk:    graphics.Color(0xFF6272A4),

	Overlay:    true,
	ThumbInset: 2,
}
View Source
var DefaultScrollPaneTheme = &ScrollPaneTheme{
	BackgroundInk:   0x00000000,
	EdgeInk:         0x00000000,
	TextInk:         graphics.Color(0xFFFFFFFF),
	SelectedInk:     graphics.Color(0x445064A1),
	HoverInk:        graphics.Color(0x334F566D),
	AlternateRowInk: graphics.Color(0x11FFFFFF),
	Font:            nil,
}

ScrollPaneTheme defines the visual style for ScrollPane widgets.

View Source
var DefaultSliderTheme = &SliderTheme{
	TrackInk:    graphics.Color(0xFF4B5163),
	TrackFilled: graphics.Color(0xFF5064A1),
	ThumbInk:    graphics.Color(0xFFC3C6C6),
	ThumbHover:  graphics.Color(0xFFFFFFFF),
	EdgeInk:     graphics.Color(0xFF6272A4),
	TickColor:   graphics.Color(0xFF666666),
	ThumbSize:   16,
	TickLength:  4,
}
View Source
var DefaultSpinBoxTheme = &SpinBoxTheme{
	BackgroundInk:    graphics.Color(0xFF3A3D4C),
	EdgeInk:          graphics.Color(0xFF6272A4),
	TextInk:          graphics.Color(0xFFFFFFFF),
	ButtonInk:        graphics.Color(0xFF4F566D),
	ButtonPressedInk: graphics.Color(0xFF2A2A2A),
	ArrowInk:         graphics.Color(0xFF6272A4),
	Font:             nil,
}
View Source
var DefaultStackPanelTheme = &StackPanelTheme{

	BackgroundInk:    0x00000000,
	SplitterInk:      graphics.Color(0xFF3C3C3C),
	SplitterHoverInk: graphics.Color(0xFF5A6480),

	GripInk:      0,
	GripSize:     4,
	SplitterSize: 4,

	HoverColorAlwaysOn: false,
}
View Source
var DefaultStatusBarTheme = &StatusBarTheme{
	BackgroundInk: graphics.Color(0xFF414450),
	EdgeInk:       graphics.Color(0xFF6272A4),
	TextInk:       graphics.Color(0xFFC3C6C6),
	GripInk:       graphics.Color(0xFF5A6480),
	Font:          nil,
}
View Source
var DefaultSwitchTheme = &SwitchTheme{
	TrackOn:  graphics.Color(0xFF5064A1),
	TrackOff: graphics.Color(0xFF4A4A4A),
	ThumbInk: graphics.Color(0xFFE0E0E0),
}
View Source
var DefaultTabTheme = &TabTheme{
	BackgroundInk:    graphics.Color(0xFF414450),
	BackgroundActive: graphics.Color(0xFF414450),
	BackgroundHover:  graphics.Color(0xFF4A4F60),
	EdgeInk:          graphics.Color(0xFF6272A4),
	TextInk:          graphics.Color(0xFFC3C6C6),
	TextActive:       graphics.Color(0xFFFFFFFF),
	TextHover:        graphics.Color(0xFFFFFFFF),
	IndicatorInk:     graphics.Color(0xFF8A9CC8),
	IndicatorHeight:  2.0,
	CornerRadius:     0,
	HMargin:          10,
	VMargin:          6,
	TabHeight:        24,
	CloseSize:        12,
	Font:             nil,
}
View Source
var DefaultTableTheme = &TableTheme{
	BackgroundInk:    graphics.Color(0xFF3A3D4C),
	EdgeInk:          graphics.Color(0xFF6272A4),
	TextInk:          graphics.Color(0xFFFFFFFF),
	SelectedInk:      graphics.Color(0x445064A1),
	HoverInk:         graphics.Color(0x334F566D),
	AlternateRowInk:  graphics.Color(0x11FFFFFF),
	SecondaryTextInk: graphics.Color(0xFF8A919E),
	GridInk:          graphics.Color(0xFF4B5163),
	HeaderBgInk:      graphics.Color(0xFF454B60),
	AccentInk:        graphics.Color(0xFF6272A4),
	SelectedTextInk:  graphics.Color(0xFFFFFFFF),
	Font:             nil,
}

TableTheme defines the visual style for Table widgets.

View Source
var DefaultTextAreaTheme = &TextAreaTheme{
	BackgroundInk:     graphics.Color(0xFF3A3D4C),
	BackgroundFocused: graphics.Color(0xFF414863),
	EdgeInk:           graphics.Color(0xFF6272A4),
	EdgeFocused:       graphics.Color(0xFF8A9CC8),
	TextInk:           graphics.Color(0xFFFFFFFF),
	PlaceholderInk:    graphics.Color(0xFF6F737A),
	SelectionColor:    graphics.Color(0x445064A1),
	GutterBgInk:       graphics.Color(0xFF363947),
	GutterTextInk:     graphics.Color(0xFF6F737A),
	GutterActiveInk:   graphics.Color(0xFFC3C6C6),
	Font:              nil,
}
View Source
var DefaultTextFieldTheme = &TextFieldTheme{
	BackgroundInk:     graphics.Color(0xFF3A3D4C),
	BackgroundFocused: graphics.Color(0xFF414863),
	EdgeInk:           graphics.Color(0xFF6272A4),
	EdgeFocused:       graphics.Color(0xFF8A9CC8),
	EdgeHovered:       graphics.Color(0xFF5A6480),
	TextInk:           graphics.Color(0xFFFFFFFF),
	TextDisabled:      graphics.Color(0xFF6F737A),
	PlaceholderInk:    graphics.Color(0xFF6F737A),
	SelectionInk:      graphics.Color(0x445064A1),
	SelectedTextInk:   graphics.Color(0xFFFFFFFF),
	CornerRadius:      4,
	HMargin:           6,
	VMargin:           3,
	Font:              nil,
}
View Source
var DefaultToolBarTheme = &ToolBarTheme{
	BackgroundInk: graphics.Color(0xFF414450),
	EdgeInk:       graphics.Color(0xFF6272A4),
	ButtonInk:     graphics.Color(0xFF4A4F60),
	ButtonHover:   graphics.Color(0xFF565D75),
	ButtonToggled: graphics.Color(0x445064A1),
	IconInk:       graphics.Color(0xFFC3C6C6),
	TextInk:       graphics.Color(0xFFC3C6C6),
	SeparatorInk:  graphics.Color(0xFF4B5163),
	Font:          nil,
}
View Source
var DefaultTooltipTheme = &TooltipTheme{
	BackgroundInk: graphics.Color(0xFF414450),
	EdgeInk:       graphics.Color(0xFF6272A4),
	TextInk:       graphics.Color(0xFFC3C6C6),
	Font:          nil,
}
View Source
var LightMarkdownTheme = &MarkdownTheme{

	Background:      graphics.Color(0xFFFFFFFF),
	TextInk:         graphics.Color(0xFF0F1115),
	HeadingInk:      []graphics.Color{0xFF0F1115, 0xFF0F1115, 0xFF0F1115, 0xFF3C3E41, 0xFF525256, 0xFF787A7C},
	ListMarkerInk:   graphics.Color(0xFF81858C),
	QuoteInk:        graphics.Color(0xFF525256),
	QuoteBackground: graphics.Color(0x00000000),
	LinkInk:         graphics.Color(0xFF4176E6),

	CodeTextInk:          graphics.Color(0xFF3C3E41),
	CodeBackground:       graphics.Color(0xFFF5F6F7),
	CodeLabelInk:         graphics.Color(0xFF81858C),
	InlineCodeInk:        graphics.Color(0xFF0F1115),
	InlineCodeBackground: graphics.Color(0xFFF5F6F7),

	TableHeaderInk:         graphics.Color(0xFF0F1115),
	TableHeaderBackground:  graphics.Color(0xFFF9FAFB),
	TableRowEvenBackground: graphics.Color(0xFFFFFFFF),
	TableRowOddBackground:  graphics.Color(0xFFFAFAFA),
	TableBorderInk:         graphics.Color(0xFFE5E5E5),
	TableHeaderRuleInk:     graphics.Color(0xFFE0E0E0),
	TableCellPadX:          10,
	TableCellPadY:          6,
	TableRowMinHeight:      26,

	RuleInk:                  graphics.Color(0xFFECEEF0),
	TaskDoneInk:              graphics.Color(0xFF4176E6),
	TaskTodoInk:              graphics.Color(0xFF81858C),
	SearchHighlightInk:       graphics.Color(0x334176E6),
	SearchHighlightStrongInk: graphics.Color(0x33F5F6F7),

	CodePadX:      12,
	CodePadY:      10,
	BlockGap:      10,
	QuoteBarWidth: 3,
	QuotePadX:     12,
	HeadingSizes:  []float32{26, 20, 17, 15, 14, 13},
}

LightMarkdownTheme is the DeepSeek harness's document palette, and every value in it was READ OFF THE REFERENCE SCREENSHOT rather than chosen.

Measured from Screenshot_20260929_231734.png by sampling pixels and counting them, because "looks like" is not a specification: the page is 74.6% #FFFFFF, #F9FAFB is 13.5% (the panel and alternating rows), #E5E5E5 and #ECEEF0 are the borders, and #0F1115 is the text. The accent is #4176E6 — the most saturated colour in the image at 1308 pixels, and the one deliberate choice among the antialiasing.

The complete mapping, with counts, is in LOOK-REFERENCE.md.

Functions

func Apply

func Apply(t *Theme)

Apply installs t as the active theme in one step: the IntelliJ colour set is resolved into every widget theme struct, then the global default is swapped, ThemeVersion bumps, and listeners are notified.

Startup and interactive switching must both go through this function. The split pair (ApplyIntelliJTheme + SetDefaultTheme) lets callers forget half: skipping SetDefaultTheme leaves DefaultTheme stale while widget themes change; skipping ApplyIntelliJTheme swaps the global pointer but every widget keeps rendering the previous colour set indefinitely. One call, one state.

func ApplyAccent

func ApplyAccent(t *Theme, c graphics.Color)

ApplyAccent overrides the accent-derived tokens on t in place. The platform's translucency convention for selection is preserved: translucent selections keep their alpha, opaque ones become the new accent. Call with the theme already loaded, then re-Apply(t) to regenerate the widget themes.

func ApplyIntelliJTheme

func ApplyIntelliJTheme(t *Theme)

ApplyIntelliJTheme derives all per-widget theme defaults from the given Theme.

func AutoPresetID

func AutoPresetID() string

AutoPresetID returns the preset that best matches the runtime platform + system mode. Unknown desktops fall back to the meui family, never to another vendor's look.

func CurrentMarkdownPaletteIsLight

func CurrentMarkdownPaletteIsLight() bool

CurrentMarkdownPaletteIsLight reports which built-in palette is active. A test that lightened the renderer and forgot is otherwise invisible.

func DetectAccent

func DetectAccent() (graphics.Color, bool)

DetectAccent returns the system accent color when the platform exposes one.

func DetectPlatform

func DetectPlatform() (Platform, Mode)

DetectPlatform reports the runtime platform family and mode.

func DiffThemes

func DiffThemes(a, b *Theme) []string

DiffThemes returns a sorted list of "path: old -> new" lines covering every palette and token difference between a and b. It backs a theme editor's change view and the round-trip tests.

func DiffWidgetThemes

func DiffWidgetThemes(a, b map[string]map[string]any) []string

DiffWidgetThemes compares two ResolvedWidgetThemes snapshots and returns sorted "widgets.<name>.<field>: old -> new" lines.

Snapshots are the input rather than *Theme values because the widget structs are process-global singletons regenerated on every Apply — only a snapshot taken right after loading a theme is meaningful. Use ResolvedWidgetThemes between loads.

func LoadAutoPreset

func LoadAutoPreset() error

LoadAutoPreset installs the detected platform preset and overlays the system accent color when the platform exposes one.

func LoadPreset

func LoadPreset(id string) error

LoadPreset installs a native platform preset by ID (see PresetIDs). It sets the shape first (the generator reads the global shape), then runs the single Apply path.

func LoadThemeFile

func LoadThemeFile(path string) (string, error)

LoadThemeFile parses a native theme file, registers it under its ID, and returns the ID (loadable via LoadPreset, usable in MEUI_THEME).

func LoadThemeFileData

func LoadThemeFileData(data []byte) (string, error)

LoadThemeFileData parses a native theme file from memory, registers it under its ID, and returns the ID. Editors and tests use this to avoid a round-trip through the filesystem.

func OnThemeChanged

func OnThemeChanged(fn func())

OnThemeChanged registers fn to run whenever SetDefaultTheme is called. Multiple listeners are supported: the window layer repaints every open window and any module (charts, app code) may register its own sync.

This was previously a single exported func variable, so whichever package assigned it last silently disabled the others — the same clobber that broke live theme switching in the production stack (meui-charts replaced meui's window-repaint callback). Registration is now additive.

func ParseHexAccent

func ParseHexAccent(s string) (graphics.Color, bool)

ParseHexAccent parses "#RRGGBB" / "0xRRGGBB" / "RRGGBB" — the MEUI_ACCENT override format.

func PresetIDs

func PresetIDs() []string

PresetIDs returns the registered native preset IDs, sorted.

func RegisterPreset

func RegisterPreset(id string, build func() *Theme) error

RegisterPreset adds a builder under id. Fails on duplicate IDs.

func ResolvedWidgetThemes

func ResolvedWidgetThemes() map[string]map[string]any

ResolvedWidgetThemes snapshots the current per-widget theme singletons as name -> field map, encoded exactly like the theme file (colours as hex, fonts as {family,size}, enums numerically).

This is read-only output. The structs are a pure function of the active Theme and Shape and are regenerated on every Apply, so snapshot right after loading the theme you care about. To compare two themes, load one, snapshot, load the other, then DiffWidgetThemes.

func SaveThemeFile

func SaveThemeFile(path string, t *Theme) error

SaveThemeFile writes ToThemeFile(t) to path.

func ScaleFonts

func ScaleFonts(t *Theme, scale float32)

func SetDefaultTheme

func SetDefaultTheme(t *Theme)

func SetFontResolver

func SetFontResolver(fn func(family string, size float32) graphics.Font)

SetFontResolver installs the application font lookup used by presets to resolve their typography stacks. Return nil for unknown families — the preset then falls through to the next family in its stack.

func SetLookAndFeel

func SetLookAndFeel(name string) error

SetLookAndFeel applies a named shape preset: "flat", "meui", "windows11", "macos".

func SetShape

func SetShape(s *ShapeTheme)

SetShape installs a shape profile and propagates it to the widget theme structs (in-place, so widgets holding pointers see it live). Fires the theme-change listeners so open windows repaint.

func ShapeName

func ShapeName() string

ShapeName returns the active preset name ("meui", "macos", …).

func ThemeVersion

func ThemeVersion() uint64

ThemeVersion returns the current global theme version. Used by cache invalidation.

func ToThemeFile

func ToThemeFile(t *Theme) ([]byte, error)

ToThemeFile renders t as a native theme file: the friendly palette plus a complete "tokens" section covering every non-colour theme field and the platform token groups. Loading the result reproduces t for everything the format carries — BaseFont is host-resolved and deliberately excluded.

The id is t.Meta.ID (falling back to t.Name). LoadThemeFile rejects a duplicate id, so a caller saving an edited copy should set a fresh one.

func TokenColor

func TokenColor(name string) (graphics.Color, bool)

TokenColor resolves a QML style token ("text", "secondary", "disabled", "accent", "error", "warning", "success", "link", "border", "background", "surface") against the ACTIVE theme. Widgets that keep a token re-resolve it per paint, so runtime theme switches recolour them; parse-time resolution would freeze the old palette.

func UseMarkdownPalette

func UseMarkdownPalette(m Mode)

UseMarkdownPalette selects the built-in palette for a mode. Light is the reference's measured palette; dark is the one the renderer used to hardcode.

func UseSystemFont

func UseSystemFont()

UseSystemFont re-points the default theme at the CURRENT system font and invalidates cached text.

It is the second half of changing a font at runtime. graphics.ReloadSystemFont re-resolves the font; this makes the theme use it. Both are needed and neither package can do the other's half — theme imports graphics, not the reverse — and a swap that misses either one leaves the app drawing the old glyphs with no error anywhere.

The version bump is not optional: widgets cache the face they were built with, so re-pointing BaseFont without invalidating leaves every already-laid-out label on the old font.

func WidgetThemeNames

func WidgetThemeNames() []string

WidgetThemeNames returns the per-widget theme names, sorted.

Types

type ButtonTheme

type ButtonTheme struct {
	BackgroundInk     graphics.Color
	BackgroundHover   graphics.Color
	BackgroundPressed graphics.Color
	BackgroundActive  graphics.Color
	EdgeInk           graphics.Color
	TextInk           graphics.Color
	TextActive        graphics.Color
	TextDisabled      graphics.Color
	CornerRadius      float32
	EdgeWidth         float32 // 0 = borderless (Metro)
	HMargin           float32
	VMargin           float32
	Font              graphics.Font
}

func (*ButtonTheme) Copy

func (t *ButtonTheme) Copy() *ButtonTheme

type CalendarTheme

type CalendarTheme struct {
	BackgroundInk    graphics.Color
	BackgroundActive graphics.Color
	BackgroundHover  graphics.Color
	EdgeInk          graphics.Color
	TextInk          graphics.Color
	TextActive       graphics.Color
	TextHover        graphics.Color
	CornerRadius     float32
	HMargin          float32
	VMargin          float32
	TabHeight        float32
	CloseSize        float32
	Font             graphics.Font
}

func (*CalendarTheme) Copy

func (t *CalendarTheme) Copy() *CalendarTheme

type CheckBoxTheme

type CheckBoxTheme struct {
	BackgroundInk   graphics.Color
	BackgroundHover graphics.Color
	EdgeInk         graphics.Color
	EdgeFocused     graphics.Color
	SelectionInk    graphics.Color
	TextInk         graphics.Color
	TextDisabled    graphics.Color
	BoxSize         float32
	BoxSpacing      float32
	CornerRadius    float32
	Font            graphics.Font
}

func (*CheckBoxTheme) Copy

func (t *CheckBoxTheme) Copy() *CheckBoxTheme

type Chrome

type Chrome struct {
	Style        ChromeStyle
	Height       float32
	ButtonW      float32
	ButtonH      float32
	ButtonGap    float32
	HoverBg      graphics.Color
	PressedBg    graphics.Color
	CloseHoverBg graphics.Color
	GlyphColor   graphics.Color
	TitleAlign   TitleAlign
	TitleWeight  int

	// BorderWidth/BorderInk draw one outline around the whole window, the
	// chrome included. Width 0 means none (macOS windows have no outline);
	// an ink of 0 falls back to the theme's Border colour, so an imported
	// theme's palette still drives it.
	BorderWidth float32
	BorderInk   graphics.Color
}

Chrome is the window-decoration token set.

func DefaultChrome

func DefaultChrome() Chrome

DefaultChrome returns the meui title bar tokens.

type ChromeStyle

type ChromeStyle string

ChromeStyle selects the window-button construction. WindowFrame consumes this in Phase 2; "meui" and "macos" are already implemented there, the rest are the platform targets.

const (
	ChromeMeui    ChromeStyle = "meui"
	ChromeMacOS   ChromeStyle = "macos"
	ChromeWindows ChromeStyle = "windows"
	ChromeGNOME   ChromeStyle = "gnome"
	ChromeKDE     ChromeStyle = "kde"
	ChromeMetro   ChromeStyle = "metro"
)

type ColorPickerTheme

type ColorPickerTheme struct {
	BackgroundInk    graphics.Color
	BackgroundActive graphics.Color
	BackgroundHover  graphics.Color
	EdgeInk          graphics.Color
	TextInk          graphics.Color
	TextActive       graphics.Color
	TextHover        graphics.Color
	CornerRadius     float32
	HMargin          float32
	VMargin          float32
	TabHeight        float32
	CloseSize        float32
	Font             graphics.Font
}

func (*ColorPickerTheme) Copy

type ComboBoxTheme

type ComboBoxTheme struct {
	BackgroundInk    graphics.Color
	EdgeInk          graphics.Color
	TextInk          graphics.Color
	TextDisabled     graphics.Color
	ArrowInk         graphics.Color
	HoverInk         graphics.Color
	SelectedInk      graphics.Color
	OptionHeight     float32
	ArrowSize        float32
	ArrowStyle       uint8 // 0 = triangle, 1 = chevron
	BottomEdgeInk    graphics.Color
	BottomEdgeWidth  float32
	BottomFocusWidth float32
	CornerRadius     float32
	Font             graphics.Font
}

ComboBoxTheme defines the visual style for ComboBox widgets.

func (*ComboBoxTheme) Copy

func (t *ComboBoxTheme) Copy() *ComboBoxTheme

type ContextMenuTheme

type ContextMenuTheme struct {
	BackgroundInk graphics.Color
	EdgeInk       graphics.Color
	TextInk       graphics.Color
	TextDisabled  graphics.Color
	ArrowInk      graphics.Color
	HoverInk      graphics.Color
	SelectedInk   graphics.Color
	// SeparatorInk: divider lines between menu sections.
	SeparatorInk graphics.Color
	OptionHeight float32
	ArrowSize    float32
	Font         graphics.Font
}

func (*ContextMenuTheme) Copy

type ControlTokens

type ControlTokens struct {
	SliderTrackH      float32 // track thickness
	SliderTrackRadius float32 // -1 = pill (height/2), 0 = square (Metro)
	SliderTrackBorder bool    // Breeze outlines its groove
	SliderThumbBorder graphics.Color
	SliderThumbInner  graphics.Color // Fluent white thumb + accent dot
	ProgressHeight    float32
	ProgressRadius    float32 // -1 = pill
}

ControlTokens are the slider and progress-bar constructions beyond colours: track thickness/shape, thumb ring/inner dot, bar height.

func DefaultControlTokens

func DefaultControlTokens() ControlTokens

DefaultControlTokens returns the meui constructions.

type Density

type Density uint8

Density is the control-size class of a preset. It documents the spacing feel; the concrete numbers live in Metrics so presets stay explicit.

const (
	DensityRegular Density = iota
	DensityCompact
	DensityComfortable
)

type Easing

type Easing uint8

Easing names a motion curve. Mapping to concrete beziers happens in the animation layer (Phase 3), this token names the intent.

const (
	EaseStandard Easing = iota // platform default curve
	EaseDecelerate
	EaseAccelerate
	EaseLinear
	EaseSpring
)

type EditorScheme

type EditorScheme struct {
	Name       string
	Colors     map[string]string            // e.g. "LINE_NUMBERS_COLOR" → "999999"
	Attributes map[string]map[string]string // e.g. "KEYWORD" → {"FOREGROUND":"c678dd", "FONT_TYPE":"1"}
}

EditorScheme holds the parsed editor color scheme from an .icls/.xml file.

func ImportEditorScheme

func ImportEditorScheme(path string) (*EditorScheme, error)

ImportEditorScheme parses an IntelliJ .icls/.xml editor scheme file.

type Effects

type Effects struct {
	WindowShadow ShadowSpec
	PopupShadow  ShadowSpec
	MenuShadow   ShadowSpec
	// CardShadow is the elevation of a surface inside the page: a web card, a
	// panel, a raised row. It is its own token because a popup's shadow is
	// deliberately heavier than a card's, and borrowing one for the other is how
	// every surface ends up looking like a floating dialog.
	CardShadow    ShadowSpec
	Focus         FocusStyle
	Material      Material
	WindowOpacity float32
}

Effects groups shadows, focus indicator and materials.

func DefaultEffects

func DefaultEffects() Effects

DefaultEffects returns the meui effects (accent focus ring, soft popup shadow, no window material).

type FocusKind

type FocusKind uint8

FocusKind names the platform focus indicator construction.

const (
	FocusNone      FocusKind = iota
	FocusRing                // outer accent ring (macOS, Adwaita)
	FocusInset               // inner border replacement (Breeze)
	FocusTwoTone             // inner+outer contrasting rect (Fluent)
	FocusUnderline           // underline only (Metro-ish)
)

type FocusStyle

type FocusStyle struct {
	Kind   FocusKind
	Width  float32
	Offset float32
	Color  graphics.Color // accent ring / outer tone
	Alt    graphics.Color // inner tone (two-tone)
}

FocusStyle is the focus indicator token set.

type GroupBoxTheme

type GroupBoxTheme struct {
	TextInk       graphics.Color
	TextSecondary graphics.Color
	Font          graphics.Font
}

func (*GroupBoxTheme) Copy

func (t *GroupBoxTheme) Copy() *GroupBoxTheme

type InputDialogTheme

type InputDialogTheme struct {
	BackgroundInk    graphics.Color
	EdgeInk          graphics.Color
	TitleBgInk       graphics.Color
	TitleTextInk     graphics.Color
	DividerInk       graphics.Color
	LabelTextInk     graphics.Color
	InputBgInk       graphics.Color
	InputBgFocused   graphics.Color
	InputEdgeInk     graphics.Color
	InputEdgeFocused graphics.Color
	InputTextInk     graphics.Color
	CursorInk        graphics.Color
	ButtonBgInk      graphics.Color
	ButtonEdgeInk    graphics.Color
	ButtonTextInk    graphics.Color
	Font             graphics.Font
}

func (*InputDialogTheme) Copy

type InputStyle

type InputStyle uint8

InputStyle selects the text-field construction.

const (
	InputOutlined InputStyle = iota // full 1px border (all desktop platforms)
	InputFilled                     // fill only (reserved)
)

type InputTokens

type InputTokens struct {
	Style            InputStyle
	BottomInk        graphics.Color // emphasised bottom border (0 = none)
	BottomWidth      float32
	FocusBottomWidth float32 // accent bottom on focus (0 = use BottomWidth)
}

InputTokens are the text-input construction details beyond colours: Fluent outlines its TextBox with an emphasised bottom edge (1px resting, 2px accent on focus); the other platforms use a plain outline.

type LabelTheme

type LabelTheme struct {
	TextInk       graphics.Color
	TextSecondary graphics.Color
	Font          graphics.Font
}

func (*LabelTheme) Copy

func (t *LabelTheme) Copy() *LabelTheme

type ListViewTheme

type ListViewTheme struct {
	BackgroundInk   graphics.Color
	EdgeInk         graphics.Color
	TextInk         graphics.Color
	SelectedInk     graphics.Color
	HoverInk        graphics.Color
	AlternateRowInk graphics.Color
	CornerRadius    float32
	Font            graphics.Font
}

ListViewTheme defines the visual style for ListView widgets.

func (*ListViewTheme) Copy

func (t *ListViewTheme) Copy() *ListViewTheme

type MarkdownTheme

type MarkdownTheme struct {
	// Background is the page the document is drawn ON, and it is the slot that makes a
	// palette self-contained.
	//
	// Without it the renderer themes its INKS but still draws on whatever is behind it,
	// so a light palette inside a dark app is light text on a dark page: the table and
	// the code block come out right and the prose is invisible. A document is a surface,
	// and the surface is the theme's.
	//
	// The DARK palette leaves it transparent, which is deliberate and not an oversight:
	// a transparent document blends into whatever hosts it, which is what it has always
	// done, and the render-parity corpus has markdown scenes whose pixels are baselines.
	// The LIGHT palette is opaque, because a light document on a dark host is the case
	// that needs it.
	Background graphics.Color

	// ── text ──
	TextInk         graphics.Color // body text
	HeadingInk      []graphics.Color
	ListMarkerInk   graphics.Color
	QuoteInk        graphics.Color // the blockquote bar and its text
	LinkInk         graphics.Color
	QuoteBackground graphics.Color

	// ── code ──
	CodeTextInk          graphics.Color
	CodeBackground       graphics.Color
	CodeLabelInk         graphics.Color // the fence's language label
	InlineCodeInk        graphics.Color
	InlineCodeBackground graphics.Color

	// ── tables ──
	TableHeaderInk         graphics.Color
	TableHeaderBackground  graphics.Color
	TableRowEvenBackground graphics.Color
	TableRowOddBackground  graphics.Color
	TableBorderInk         graphics.Color // cell separators and the outer frame
	TableHeaderRuleInk     graphics.Color // the rule under the header row
	TableCellPadX          float32
	TableCellPadY          float32
	TableRowMinHeight      float32

	// ── rules, marks and highlights ──
	RuleInk                  graphics.Color
	TaskDoneInk              graphics.Color
	TaskTodoInk              graphics.Color
	SearchHighlightInk       graphics.Color
	SearchHighlightStrongInk graphics.Color

	// ── metrics ──
	CodePadX, CodePadY float32
	BlockGap           float32
	QuoteBarWidth      float32
	QuotePadX          float32
	HeadingSizes       []float32

	// ── fonts ──
	Font     graphics.Font
	MonoFont graphics.Font
}

MarkdownTheme is every colour, metric and font the Markdown renderer decides.

WHY IT EXISTS. The renderer used to decide all of these ITSELF: thirty colour literals in widgets/markdown.go, and they were VS Code's dark+ palette exactly (#1E1E1E for a code block, #569CD6 for a link, #6A9955 for a constant). So a document rendered the same in every theme, a light theme got a dark code block, and no theme could restyle it at all. AGENTS.md already requires this of chrome — "nothing in widgets hardcodes a chrome colour" — and a Markdown document is not less chrome than a title bar.

It follows the widget-theme convention: a global DefaultMarkdownTheme that the importer overwrites, and widgets embedding a pointer to it. That is how TabTheme and every other widget theme in this package already work.

func (*MarkdownTheme) Copy

func (t *MarkdownTheme) Copy() *MarkdownTheme

Copy deep-copies the theme, so a widget that changes a metric cannot change the global. The slice fields are copied too, which is the part that is easy to forget and produces a theme that changes when an unrelated widget does.

func (*MarkdownTheme) Theme

func (t *MarkdownTheme) Theme() *MarkdownTheme

Theme returns the theme, or the default if a widget embedded a nil one. A widget built before any theme was set must still paint, and a nil dereference in a paint path takes the whole window down.

type Material

type Material uint8

Material names the window backdrop treatment. Whether it can be honored depends on the compositor; the token records intent.

const (
	MaterialNone Material = iota
	MaterialTranslucent
	MaterialMica
	MaterialAcrylic
	MaterialVibrancy
)

type MdiTheme

type MdiTheme struct {
	ContainerBgInk   graphics.Color
	TabBgInk         graphics.Color
	TabActiveBgInk   graphics.Color
	TabEdgeInk       graphics.Color
	TabTextInk       graphics.Color
	TabActiveTextInk graphics.Color
	TaskbarBgInk     graphics.Color
	TaskbarTextInk   graphics.Color
	TaskbarActiveInk graphics.Color
	TaskbarBtnBgInk  graphics.Color
	TaskbarBtnHover  graphics.Color
	TaskbarBtnEdge   graphics.Color
	DockBgInk        graphics.Color
	DockEdgeInk      graphics.Color
	DockSplitInk     graphics.Color
	WinTitleBgInk    graphics.Color
	WinTitleInactive graphics.Color
	WinTitleEdgeInk  graphics.Color
	WinTitleTextInk  graphics.Color
	WinEdgeInk       graphics.Color
	WinContentBgInk  graphics.Color
	WinAccentInk     graphics.Color
	WinTextSecondary graphics.Color
	WinShadowInk     graphics.Color
	CornerRadius     float32
	Font             graphics.Font
}

func (*MdiTheme) Copy

func (t *MdiTheme) Copy() *MdiTheme
type MenuBarTheme struct {
	BackgroundInk    graphics.Color
	BackgroundHover  graphics.Color
	BackgroundActive graphics.Color
	TextInk          graphics.Color
	TextActive       graphics.Color
	TextSecondary    graphics.Color
	EdgeInk          graphics.Color
	Font             graphics.Font
}
func (t *MenuBarTheme) Copy() *MenuBarTheme

type MessageBoxTheme

type MessageBoxTheme struct {
	BackgroundInk graphics.Color
	EdgeInk       graphics.Color
	TitleBgInk    graphics.Color
	TitleTextInk  graphics.Color
	DividerInk    graphics.Color
	BodyTextInk   graphics.Color
	ButtonBgInk   graphics.Color
	ButtonEdgeInk graphics.Color
	ButtonTextInk graphics.Color
	Font          graphics.Font
}

func (*MessageBoxTheme) Copy

func (t *MessageBoxTheme) Copy() *MessageBoxTheme

type Meta

type Meta struct {
	ID       string
	Platform Platform
	Mode     Mode
}

Meta identifies a loaded preset.

type Metrics

type Metrics struct {
	Density            Density
	ControlHeight      float32 // buttons, inputs, combo, spinbox
	ControlPadX        float32 // button horizontal content padding
	ControlPadY        float32 // button vertical content padding
	InputPadX          float32 // text field / text area horizontal padding
	MenuItemHeight     float32
	ListRowHeight      float32
	TabHeight          float32
	ToolbarHeight      float32
	StatusBarHeight    float32
	ScrollbarWidth     float32
	ScrollbarOverlay   bool // thin floating pill, NO track band (macOS/GNOME)
	ScrollbarAutoHide  bool // bars fade out when idle (opt-in; default: persistent)
	BorderWidth        float32
	FocusRingWidth     float32
	FocusRingOffset    float32
	BoxSize            float32 // checkbox/radio box
	BoxSpacing         float32 // box-to-label gap
	SliderThumb        float32 // slider knob diameter
	ArrowSize          float32 // combo/spin arrows
	GripSize           float32 // splitview/stackpanel grips
	ControlBorderWidth float32 // button/input border (0 = borderless, Metro)
	TabIndicatorHeight float32 // active-tab underline (0 = fill-only platforms)
	TabActiveFilled    bool    // active tab gets a lighter fill (macOS/GNOME/Breeze)
	ArrowStyle         uint8   // 0 = triangle, 1 = chevron (Fluent/macOS/GNOME/KDE)
	SwitchH            float32 // toggle track height (width = 2x)
	SliderTrack        float32 // slider groove thickness (0 = meui 6)
	SliderTrackRadius  float32 // -1 = pill
	ProgressHeight     float32 // progress bar thickness (0 = meui 6)
	ProgressRadius     float32 // -1 = pill
	// NavBarHeight is a bottom navigation bar's height: 64 on Android, 49 on iOS. It is
	// its own metric because a tab strip and a bottom bar are different controls with
	// different heights on the same platform, and borrowing one for the other is how
	// they silently drift. Zero falls back to TabHeight.
	NavBarHeight float32
	// NavRailWidth is a navigation rail's width: the column the same destinations occupy
	// when there is room beside the content instead of below it.
	NavRailWidth float32
	// MinTouchTarget is the minimum hit area for an interactive widget, in logical
	// px: 48 on Android, 44 on iOS, 0 on a pointer-driven desktop where a small
	// control is not a usability problem. It is a METRIC because it is a size, but
	// it is enforced in one place — the hit test — rather than by every widget.
	MinTouchTarget float32
	Shape          *ShapeTheme
}

Metrics is the density/geometry token set: control heights, paddings and small-element sizes in logical pixels. The generator pushes these into every widget theme dimension field; widgets stop hardcoding their own.

func DefaultMetrics

func DefaultMetrics() Metrics

DefaultMetrics returns the meui/current geometry so themes that do not define metrics (IntelliJ imports, DarkTheme) keep their sizing.

type Mode

type Mode uint8

Mode selects the light/dark variant of a preset.

const (
	ModeDark Mode = iota
	ModeLight
	ModeHighContrast
)

func (Mode) String

func (m Mode) String() string

type Motion

type Motion struct {
	Hover, Press, Focus, Toggle Timing
	MenuOpen, MenuClose         Timing
	TooltipShow, TooltipHide    Timing
	ScrollFade                  Timing
}

Motion holds the interaction timings. Platforms differ (Fluent 83–300ms, macOS 120–250ms, Adwaita ~200ms, Metro near-instant).

func DefaultMotion

func DefaultMotion() Motion

DefaultMotion returns the meui timings.

type Platform

type Platform string

Platform identifies the OS/desktop family a preset targets. It selects chrome style, metrics and motion, never behavior.

const (
	PlatformMeui      Platform = "meui"
	PlatformMacOS     Platform = "macos"
	PlatformWindows11 Platform = "windows11"
	PlatformMetro     Platform = "metro"
	PlatformGNOME     Platform = "gnome"
	PlatformKDE       Platform = "kde"
	// The mobile families. They are LOOK presets like every other entry here — the
	// behaviour that follows from being on a phone (touch targets, sheets, back
	// navigation) belongs to platform.FormFactor, not to the theme.
	PlatformAndroid Platform = "android"
	PlatformIOS     Platform = "ios"
	// PlatformWeb is the look of a web page rather than a desktop window: an 8px
	// grid, a document type scale, larger radii and a card elevation. Like the
	// mobile families it is a LOOK preset — the behaviour a page needs (scrolling,
	// hover, focus-visible) belongs to the widgets, not to the theme.
	PlatformWeb Platform = "web"
)

type PopupTheme

type PopupTheme struct {
	BackgroundInk  graphics.Color
	EdgeInk        graphics.Color
	TitleBgInk     graphics.Color
	TitleTextInk   graphics.Color
	DividerInk     graphics.Color
	HeadingTextInk graphics.Color
	ShadowInk      graphics.Color
	Font           graphics.Font
}

func (*PopupTheme) Copy

func (t *PopupTheme) Copy() *PopupTheme

type ProgressBarTheme

type ProgressBarTheme struct {
	TrackInk     graphics.Color
	FillInk      graphics.Color
	EdgeInk      graphics.Color
	CornerRadius float32
	Height       float32
}

func (*ProgressBarTheme) Copy

type RadioButtonTheme

type RadioButtonTheme struct {
	BackgroundInk   graphics.Color
	BackgroundHover graphics.Color
	EdgeInk         graphics.Color
	EdgeFocused     graphics.Color
	SelectionInk    graphics.Color
	TextInk         graphics.Color
	TextDisabled    graphics.Color
	BoxSize         float32
	BoxSpacing      float32
	Font            graphics.Font
}

func (*RadioButtonTheme) Copy

type ScrollBarTheme

type ScrollBarTheme struct {
	TrackInk   graphics.Color
	ThumbInk   graphics.Color
	ThumbHover graphics.Color
	EdgeInk    graphics.Color
	Overlay    bool    // thin floating pill, no track (macOS/GNOME)
	AutoHide   bool    // fade out while idle (opt-in; default: persistent)
	ThumbInset float32 // inset from the bar edges (overlay pill margin)
}

ScrollBarTheme defines the visual style for ScrollBar widgets.

func (*ScrollBarTheme) Copy

func (t *ScrollBarTheme) Copy() *ScrollBarTheme

type ScrollPaneTheme

type ScrollPaneTheme struct {
	BackgroundInk   graphics.Color
	EdgeInk         graphics.Color
	TextInk         graphics.Color
	SelectedInk     graphics.Color
	HoverInk        graphics.Color
	AlternateRowInk graphics.Color
	CornerRadius    float32
	Font            graphics.Font
}

func (*ScrollPaneTheme) Copy

func (t *ScrollPaneTheme) Copy() *ScrollPaneTheme

type ShadowSpec

type ShadowSpec struct {
	Color        graphics.Color
	DX, DY       float32
	Blur, Spread float32
}

ShadowSpec is one drop-shadow description. Blur/Spread/DX/DY in logical pixels; alpha lives in Color.

type ShapeTheme

type ShapeTheme struct {
	Window    float32 // main window corner radius (0 = square)
	Popup     float32 // modal popups, dialogs
	Menu      float32 // menu bar dropdowns, context menus
	Tooltip   float32
	Button    float32
	CheckBox  float32
	Input     float32 // TextField, SpinBox
	ComboBox  float32
	Tab       float32
	GroupBox  float32
	ListRow   float32
	ScrollBar float32
}

ShapeTheme is the look-and-feel shape profile: corner radii per widget class, in logical pixels. It is orthogonal to the color theme — any color theme combines with any shape profile.

func Shape

func Shape() *ShapeTheme

Shape returns the active shape profile. Widgets read radii from here (or from their theme structs, which SetShape keeps in sync).

func ShapeFlat

func ShapeFlat() *ShapeTheme

Named L&F presets. Values in logical px.

func ShapeMacOS

func ShapeMacOS() *ShapeTheme

func ShapeMeui

func ShapeMeui() *ShapeTheme

ShapeMeui is the current default look (subtle 4px rounding).

func ShapeWindows11

func ShapeWindows11() *ShapeTheme

type SliderTheme

type SliderTheme struct {
	TrackInk    graphics.Color
	TrackFilled graphics.Color
	ThumbInk    graphics.Color
	ThumbHover  graphics.Color
	EdgeInk     graphics.Color
	TickColor   graphics.Color
	ThumbBorder graphics.Color // ring around the thumb (0 = none)
	ThumbInner  graphics.Color // centre dot (Fluent; 0 = none)
	Font        graphics.Font
	ThumbSize   float32
	TickLength  float32
	TrackHeight float32
	TrackRadius float32 // -1 = pill
	TrackBorder bool    // outline the groove (Breeze)
}

func (*SliderTheme) Copy

func (t *SliderTheme) Copy() *SliderTheme

type SpinBoxTheme

type SpinBoxTheme struct {
	BackgroundInk    graphics.Color
	EdgeInk          graphics.Color
	TextInk          graphics.Color
	ButtonInk        graphics.Color
	ButtonPressedInk graphics.Color
	ArrowInk         graphics.Color
	CornerRadius     float32
	Font             graphics.Font
}

SpinBoxTheme defines the visual style for SpinBox widgets.

func (*SpinBoxTheme) Copy

func (t *SpinBoxTheme) Copy() *SpinBoxTheme

type StackPanelTheme

type StackPanelTheme struct {
	BackgroundInk graphics.Color
	// SplitterInk is the divider line between panels, SplitterHoverInk the
	// same line while the pointer is on it or it is being dragged. GripInk
	// is optional decoration on the handle (0 = the line alone).
	SplitterInk      graphics.Color
	SplitterHoverInk graphics.Color
	GripInk          graphics.Color
	GripSize         float32
	SplitterSize     float32
	CornerRadius     float32
	// HoverColorAlwaysOn draws every divider in SplitterHoverInk, so it
	// reads as a highlight that does not depend on where the pointer is.
	// The IntelliJ importer turns it on: an imported L&F's splitters are
	// near-invisible in its own palette (their colour is the same tone as the
	// surrounding chrome), and the accent line is what reads there.
	HoverColorAlwaysOn bool
}

func (*StackPanelTheme) Copy

func (t *StackPanelTheme) Copy() *StackPanelTheme

type StatusBarTheme

type StatusBarTheme struct {
	BackgroundInk graphics.Color
	EdgeInk       graphics.Color
	TextInk       graphics.Color
	GripInk       graphics.Color
	Font          graphics.Font
}

func (*StatusBarTheme) Copy

func (t *StatusBarTheme) Copy() *StatusBarTheme

type SwitchTheme

type SwitchTheme struct {
	TrackOn  graphics.Color
	TrackOff graphics.Color
	ThumbInk graphics.Color // knob when ON (on-accent)
	ThumbOff graphics.Color // knob when OFF
}

func (*SwitchTheme) Copy

func (t *SwitchTheme) Copy() *SwitchTheme

type TabTheme

type TabTheme struct {
	BackgroundInk    graphics.Color
	BackgroundActive graphics.Color
	BackgroundHover  graphics.Color
	EdgeInk          graphics.Color
	TextInk          graphics.Color
	TextActive       graphics.Color
	TextHover        graphics.Color
	IndicatorInk     graphics.Color
	IndicatorHeight  float32
	CornerRadius     float32
	HMargin          float32
	VMargin          float32
	TabHeight        float32
	CloseSize        float32
	Font             graphics.Font
}

func (*TabTheme) Copy

func (t *TabTheme) Copy() *TabTheme

type TableTheme

type TableTheme struct {
	BackgroundInk   graphics.Color
	EdgeInk         graphics.Color
	TextInk         graphics.Color
	SelectedInk     graphics.Color
	HoverInk        graphics.Color
	AlternateRowInk graphics.Color
	// SecondaryTextInk: header labels, row numbers, de-emphasized text.
	SecondaryTextInk graphics.Color
	// GridInk: cell grid lines and row separators.
	GridInk graphics.Color
	// HeaderBgInk: column header background.
	HeaderBgInk graphics.Color
	// AccentInk: sort indicators, edit highlights, drop targets.
	AccentInk graphics.Color
	// SelectedTextInk: text drawn on selected/hovered rows.
	SelectedTextInk graphics.Color
	CornerRadius    float32
	Font            graphics.Font
}

func (*TableTheme) Copy

func (t *TableTheme) Copy() *TableTheme

type TextAreaTheme

type TextAreaTheme struct {
	BackgroundInk     graphics.Color
	BackgroundFocused graphics.Color
	EdgeInk           graphics.Color
	EdgeFocused       graphics.Color
	TextInk           graphics.Color
	PlaceholderInk    graphics.Color
	SelectionColor    graphics.Color
	GutterBgInk       graphics.Color
	GutterTextInk     graphics.Color
	GutterActiveInk   graphics.Color
	CornerRadius      float32
	Font              graphics.Font
}

TextAreaTheme defines the visual style for TextArea widgets.

func (*TextAreaTheme) Copy

func (t *TextAreaTheme) Copy() *TextAreaTheme

type TextFieldTheme

type TextFieldTheme struct {
	BackgroundInk     graphics.Color
	BackgroundFocused graphics.Color
	EdgeInk           graphics.Color
	EdgeFocused       graphics.Color
	EdgeHovered       graphics.Color
	TextInk           graphics.Color
	TextDisabled      graphics.Color
	PlaceholderInk    graphics.Color
	SelectionInk      graphics.Color
	SelectedTextInk   graphics.Color
	CornerRadius      float32
	BottomEdgeInk     graphics.Color // emphasised bottom border (Fluent)
	BottomEdgeWidth   float32
	BottomFocusWidth  float32
	HMargin           float32
	VMargin           float32
	Font              graphics.Font
}

func (*TextFieldTheme) Copy

func (t *TextFieldTheme) Copy() *TextFieldTheme

type TextStyle

type TextStyle struct {
	Size          float32
	Weight        int
	LineHeight    float32
	LetterSpacing float32
}

TextStyle is one typographic role.

type Theme

type Theme struct {
	Name           string
	Primary        graphics.Color
	Secondary      graphics.Color
	Accent         graphics.Color
	OnAccent       graphics.Color // text/glyph on accent fills (0 = derive)
	Background     graphics.Color
	Surface        graphics.Color
	SurfaceVariant graphics.Color
	TextPrimary    graphics.Color
	TextSecondary  graphics.Color
	Border         graphics.Color
	BorderStrong   graphics.Color // control strokes (fields, boxes)
	BorderSubtle   graphics.Color // separators, table grids
	BorderFocused  graphics.Color
	BorderHovered  graphics.Color
	Hovered        graphics.Color
	Pressed        graphics.Color
	Selected       graphics.Color
	// SelectedWash is the translucent accent a SELECTED SURFACE is washed with (a nav
	// item, a list row, a day cell). It is separate from Selected, which is an opaque
	// fill role used for selected text and checked states — washing a row with that
	// paints solid accent over its own label. Zero means "derive from Selected".
	SelectedWash   graphics.Color
	Disabled       graphics.Color
	DisabledText   graphics.Color
	DisabledBg     graphics.Color
	DisabledBorder graphics.Color
	BorderRadius   float32
	BaseFont       graphics.Font
	FontSizeSmall  float32
	FontSizeMedium float32
	FontSizeLarge  float32
	FontSizeTitle  float32

	FontWeightNormal  int
	FontWeightBold    int
	LineHeight        float32
	Success           graphics.Color
	Warning           graphics.Color
	Error             graphics.Color
	Shadow            graphics.Color
	TooltipBackground graphics.Color
	TooltipText       graphics.Color
	Link              graphics.Color
	LinkVisited       graphics.Color
	MenuBackground    graphics.Color
	MenuHighlight     graphics.Color
	ScrollBarTrack    graphics.Color
	ScrollBarThumb    graphics.Color
	ScrollbarWidth    float32
	ChartGrid         graphics.Color
	ChartAxis         graphics.Color

	// Platform token groups (see THEME_ARCHITECTURE.md). Color roles
	// above stay the palette; these carry the non-color dimensions that
	// distinguish macOS / Windows / GNOME / KDE / Metro.
	Meta       Meta
	Metrics    Metrics
	Motion     Motion
	Typography Typography
	Effects    Effects
	Chrome     Chrome
	// SplitterHoverColorAlwaysOn asks split panels to keep their dividers in
	// the accent colour instead of only while the pointer is on them. It is a
	// property of the L&F, not of the widget: an imported IntelliJ palette
	// paints its separators in the same tone as the surrounding chrome, so a
	// hover-only highlight leaves every split invisible until it is found.
	// It feeds StackPanelTheme.HoverColorAlwaysOn on Apply.
	SplitterHoverColorAlwaysOn bool
	Inputs                     InputTokens
	Controls                   ControlTokens
	// contains filtered or unexported fields
}
var (
	DefaultTheme *Theme // The active theme, initialized to DarkTheme() in init()

)

func DarkTheme

func DarkTheme() *Theme

func ImportFlatLafTheme

func ImportFlatLafTheme(path string) (*Theme, error)

ImportFlatLafTheme loads a FlatLaf .properties or .json theme file and returns a Theme.

func ImportIntelliJTheme

func ImportIntelliJTheme(path string) (*Theme, error)

ImportIntelliJTheme loads an IntelliJ IDEA .xml/.icls theme file and returns a Theme.

func ImportIntelliJThemeJSON

func ImportIntelliJThemeJSON(path string) (*Theme, error)

ImportIntelliJThemeJSON loads an IntelliJ .theme.json file and returns a Theme. The Theme.Name is set from the "name" field and widget defaults are also updated.

func ImportVSCodeTheme

func ImportVSCodeTheme(path string) (*Theme, error)

ImportVSCodeTheme loads a VS Code .json theme file and returns a Theme.

func LightTheme

func LightTheme() *Theme

func ParseThemeFile

func ParseThemeFile(data []byte) (*Theme, error)

ParseThemeFile builds a theme from native theme file bytes **without** registering it as a preset. LoadThemeFile is for installing a theme under its id; this is for inspecting, previewing or comparing one — a tool needs to diff two revisions of the same file, which share an id and would collide in the registry.

func (*Theme) OnAccentColor

func (t *Theme) OnAccentColor() graphics.Color

OnAccentColor returns the text/glyph colour that sits on top of the accent (checked boxes, active buttons, solid selections). Presets set it explicitly where the derivation is wrong (Fluent dark uses black on its light accent); otherwise it is derived from the accent luminance.

func (*Theme) SetBackground

func (t *Theme) SetBackground(color graphics.Color) *Theme

func (*Theme) SetBaseFont

func (t *Theme) SetBaseFont(font graphics.Font) *Theme

func (*Theme) SetBorderRadius

func (t *Theme) SetBorderRadius(radius float32) *Theme

func (*Theme) SetChartAxis

func (t *Theme) SetChartAxis(color graphics.Color) *Theme

func (*Theme) SetChartGrid

func (t *Theme) SetChartGrid(color graphics.Color) *Theme

func (*Theme) SetFontSizeLarge

func (t *Theme) SetFontSizeLarge(size float32) *Theme

func (*Theme) SetFontSizeMedium

func (t *Theme) SetFontSizeMedium(size float32) *Theme

func (*Theme) SetFontSizeSmall

func (t *Theme) SetFontSizeSmall(size float32) *Theme

func (*Theme) SetFontSizeTitle

func (t *Theme) SetFontSizeTitle(size float32) *Theme

func (*Theme) SetFontWeightBold

func (t *Theme) SetFontWeightBold(weight int) *Theme

func (*Theme) SetFontWeightNormal

func (t *Theme) SetFontWeightNormal(weight int) *Theme

func (*Theme) SetLineHeight

func (t *Theme) SetLineHeight(height float32) *Theme
func (t *Theme) SetLink(color graphics.Color) *Theme

func (*Theme) SetLinkVisited

func (t *Theme) SetLinkVisited(color graphics.Color) *Theme

func (*Theme) SetMenuBackground

func (t *Theme) SetMenuBackground(color graphics.Color) *Theme

func (*Theme) SetMenuHighlight

func (t *Theme) SetMenuHighlight(color graphics.Color) *Theme

func (*Theme) SetPrimary

func (t *Theme) SetPrimary(color graphics.Color) *Theme

func (*Theme) SetScrollBarThumb

func (t *Theme) SetScrollBarThumb(color graphics.Color) *Theme

func (*Theme) SetScrollBarTrack

func (t *Theme) SetScrollBarTrack(color graphics.Color) *Theme

func (*Theme) SetSecondary

func (t *Theme) SetSecondary(color graphics.Color) *Theme

func (*Theme) SetShadow

func (t *Theme) SetShadow(color graphics.Color) *Theme

func (*Theme) SetSurface

func (t *Theme) SetSurface(color graphics.Color) *Theme

func (*Theme) SetTextPrimary

func (t *Theme) SetTextPrimary(color graphics.Color) *Theme

func (*Theme) SetTooltipBackground

func (t *Theme) SetTooltipBackground(color graphics.Color) *Theme

func (*Theme) SetTooltipText

func (t *Theme) SetTooltipText(color graphics.Color) *Theme

type Timing

type Timing struct {
	DurationMS float32
	Easing     Easing
}

Timing pairs a duration with an easing intent.

type TitleAlign

type TitleAlign uint8

TitleAlign is the window-title placement.

const (
	TitleLeft TitleAlign = iota
	TitleCenter
)

type ToolBarTheme

type ToolBarTheme struct {
	BackgroundInk graphics.Color
	EdgeInk       graphics.Color
	ButtonInk     graphics.Color
	ButtonHover   graphics.Color
	ButtonToggled graphics.Color
	IconInk       graphics.Color
	TextInk       graphics.Color
	SeparatorInk  graphics.Color
	Font          graphics.Font
}

func (*ToolBarTheme) Copy

func (t *ToolBarTheme) Copy() *ToolBarTheme

type TooltipTheme

type TooltipTheme struct {
	BackgroundInk graphics.Color
	EdgeInk       graphics.Color
	TextInk       graphics.Color
	Font          graphics.Font
}

func (*TooltipTheme) Copy

func (t *TooltipTheme) Copy() *TooltipTheme

type Typography

type Typography struct {
	Families []string
	Caption  TextStyle
	Body     TextStyle
	Label    TextStyle
	Button   TextStyle
	Title    TextStyle
	Heading  TextStyle
	Mono     TextStyle
}

Typography carries the ordered family stack (first installed wins) and the role styles. BaseFont remains the resolved face for backward compatibility; presets fill both.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL