theme
import "mazzy/mazarin/mancini/theme"
Package theme provides the default implementations of [mancini.Theme], [mancini.Palette], and [mancini.NeumorphicParams].
DefaultTheme bundles a palette, neumorphic parameters, and font resolution into a single value that satisfies [mancini.Theme]. DefaultPalette provides the standard purple neumorphic color scheme. DefaultNeumorphicParams provides two shadow parameter sets: heavy (window-weight, for [std.AppWindow]) and light (button-weight, for controls like [std.Button] and [std.Checkbox]).
Application code typically creates a theme via NewDefaultTheme or via [std.NewDefaultTheme], which delegates here.
Index
- type DefaultNeumorphicParams
- type DefaultPalette
- func NewDefaultPalette() *DefaultPalette
- func NewDefaultPaletteSwapRB() *DefaultPalette
- func NewDefaultPaletteWithColors(surface, text color.NRGBA) *DefaultPalette
- func (p *DefaultPalette) Accent() color.NRGBA
- func (p *DefaultPalette) AlternateBase() color.NRGBA
- func (p *DefaultPalette) AnsiColor(index int) color.NRGBA
- func (p *DefaultPalette) Base() color.NRGBA
- func (p *DefaultPalette) BaseText() color.NRGBA
- func (p *DefaultPalette) BrightText() color.NRGBA
- func (p *DefaultPalette) CursorColor() color.NRGBA
- func (p *DefaultPalette) CursorTextColor() color.NRGBA
- func (p *DefaultPalette) DarkShadow() color.NRGBA
- func (p *DefaultPalette) DesktopBG() color.NRGBA
- func (p *DefaultPalette) DisabledAlpha() float64
- func (p *DefaultPalette) Highlight() color.NRGBA
- func (p *DefaultPalette) HighlightText() color.NRGBA
- func (p *DefaultPalette) Icon() color.NRGBA
- func (p *DefaultPalette) LightShadow() color.NRGBA
- func (p *DefaultPalette) Link() color.NRGBA
- func (p *DefaultPalette) Mid() color.NRGBA
- func (p *DefaultPalette) Midlight() color.NRGBA
- func (p *DefaultPalette) PlaceholderText() color.NRGBA
- func (p *DefaultPalette) SetDesktopBG(c color.NRGBA)
- func (p *DefaultPalette) Shadow() color.NRGBA
- func (p *DefaultPalette) Surface() color.NRGBA
- func (p *DefaultPalette) SurfaceTint() color.NRGBA
- func (p *DefaultPalette) Text() color.NRGBA
- func (p *DefaultPalette) ToolTipBase() color.NRGBA
- func (p *DefaultPalette) ToolTipText() color.NRGBA
- func (p *DefaultPalette) WindowText() color.NRGBA
- type DefaultTheme
- func NewDefaultTheme(family string, defaultSize int64, resolve mancini.FontResolver) *DefaultTheme
- func NewTheme(pal mancini.Palette, neu mancini.NeumorphicParams, family string, defaultSize int64, resolve mancini.FontResolver) *DefaultTheme
- func (t *DefaultTheme) BodyFontSize() int64
- func (t *DefaultTheme) ControlFontSize() int64
- func (t *DefaultTheme) ControlRadius() float64
- func (t *DefaultTheme) DefaultFont() *mancini.FontConfig
- func (t *DefaultTheme) DefaultFontSize() int64
- func (t *DefaultTheme) FieldBorderWidth() float64
- func (t *DefaultTheme) FieldPadding() float64
- func (t *DefaultTheme) FieldRadius() float64
- func (t *DefaultTheme) Font(feature mancini.Feature, size int64) *mancini.FontConfig
- func (t *DefaultTheme) FontFamily() string
- func (t *DefaultTheme) FontFamilyMono() string
- func (t *DefaultTheme) Name() string
- func (t *DefaultTheme) Neumorphic() mancini.NeumorphicParams
- func (t *DefaultTheme) Palette() mancini.Palette
- func (t *DefaultTheme) ScrollbarMinThumb() float64
- func (t *DefaultTheme) ScrollbarThickness() float64
- func (t *DefaultTheme) SetMonoFamily(mono string)
- func (t *DefaultTheme) SetName(name string)
- func (t *DefaultTheme) SetStyle(s mancini.SurfaceStyle)
- func (t *DefaultTheme) SmallFontSize() int64
- func (t *DefaultTheme) Style() mancini.SurfaceStyle
- func (t *DefaultTheme) TitleFontSize() int64
- type DefaultWMTheme
- func NewDefaultWMTheme(pal mancini.Palette) *DefaultWMTheme
- func (t *DefaultWMTheme) ActiveBorderColor() color.NRGBA
- func (t *DefaultWMTheme) BorderBottom() int
- func (t *DefaultWMTheme) BorderLeft() int
- func (t *DefaultWMTheme) BorderRight() int
- func (t *DefaultWMTheme) BorderTop() int
- func (t *DefaultWMTheme) CornerRadius() float64
- func (t *DefaultWMTheme) InactiveBorderColor() color.NRGBA
- func (t *DefaultWMTheme) Name() string
- func (t *DefaultWMTheme) Palette() mancini.Palette
- func (t *DefaultWMTheme) RaisedLightAlpha() uint8
- func (t *DefaultWMTheme) SetStyle(s mancini.SurfaceStyle)
- func (t *DefaultWMTheme) ShadowBottom() int
- func (t *DefaultWMTheme) ShadowLeft() int
- func (t *DefaultWMTheme) ShadowRight() int
- func (t *DefaultWMTheme) ShadowTop() int
- func (t *DefaultWMTheme) Style() mancini.SurfaceStyle
- func (t *DefaultWMTheme) TitleActiveAlpha() uint8
- func (t *DefaultWMTheme) TitleBarHeight() int
- func (t *DefaultWMTheme) TitleFont() string
- func (t *DefaultWMTheme) TitleFontSize() int64
- func (t *DefaultWMTheme) TitleGap() int
- func (t *DefaultWMTheme) TitleInactiveAlpha() uint8
- func (t *DefaultWMTheme) TitleStyle() mancini.TitleBarStyle
- func (t *DefaultWMTheme) UnfocusedContentMode() mancini.UnfocusedMode
- func (t *DefaultWMTheme) UnfocusedDimAlpha() uint8
- func (t *DefaultWMTheme) UrgentBorderColor() color.NRGBA
type DefaultNeumorphicParams
DefaultNeumorphicParams implements [mancini.NeumorphicParams] with two parameter sets:
- Heavy — window-weight shadows with larger offsets and blur radii, used by [std.AppWindow], [std.FreeFloatingWindow], and [std.RadialMenu].
- Light — control-weight shadows with smaller, tighter parameters, used by [std.Button], [std.Checkbox], [std.Scrollbar], [std.NOfMChooser], [std.RadialNOfMChooser], and [std.SingleLineText].
Either Heavy() or Light() may be overridden to return nil in a custom implementation, disabling neumorphic rendering for that weight class.
type DefaultNeumorphicParams struct {
// contains filtered or unexported fields
}
func NewDefaultNeumorphicParams
func NewDefaultNeumorphicParams() *DefaultNeumorphicParams
NewDefaultNeumorphicParams returns the standard neumorphic shadow parameters.
func (*DefaultNeumorphicParams) Heavy
func (d *DefaultNeumorphicParams) Heavy() *mancini.NeuParams
Heavy returns the window-weight neumorphic shadow parameters.
func (*DefaultNeumorphicParams) Light
func (d *DefaultNeumorphicParams) Light() *mancini.NeuParams
Light returns the control-weight neumorphic shadow parameters.
type DefaultPalette
DefaultPalette implements [mancini.Palette] with a neumorphic color scheme. The standard palette uses a purple surface tone with complementary dark/light shadow colors.
Create with NewDefaultPalette, NewDefaultPaletteWithColors (custom surface and text), or NewDefaultPaletteSwapRB (for BGR framebuffers).
type DefaultPalette struct {
// contains filtered or unexported fields
}
func NewDefaultPalette
func NewDefaultPalette() *DefaultPalette
NewDefaultPalette returns the standard purple neumorphic palette.
func NewDefaultPaletteSwapRB
func NewDefaultPaletteSwapRB() *DefaultPalette
NewDefaultPaletteSwapRB returns the standard palette with red and blue channels pre-swapped in every color (for framebuffers that use BGR byte order). Callers can use the returned colors directly without additional swapping.
func NewDefaultPaletteWithColors
func NewDefaultPaletteWithColors(surface, text color.NRGBA) *DefaultPalette
NewDefaultPaletteWithColors returns the standard palette with custom surface and text colors. Shadow colors and other fields use defaults.
func (*DefaultPalette) Accent
func (p *DefaultPalette) Accent() color.NRGBA
Accent returns the accent color (typically same as Highlight).
func (*DefaultPalette) AlternateBase
func (p *DefaultPalette) AlternateBase() color.NRGBA
AlternateBase returns the alternating row color for Base areas.
func (*DefaultPalette) AnsiColor
func (p *DefaultPalette) AnsiColor(index int) color.NRGBA
AnsiColor returns the ANSI palette entry at index (clamped to 0-15).
func (*DefaultPalette) Base
func (p *DefaultPalette) Base() color.NRGBA
Base returns the base (input field) background color.
func (*DefaultPalette) BaseText
func (p *DefaultPalette) BaseText() color.NRGBA
BaseText returns the text color drawn on Base backgrounds.
func (*DefaultPalette) BrightText
func (p *DefaultPalette) BrightText() color.NRGBA
BrightText returns a high-contrast text color used on dark backgrounds.
func (*DefaultPalette) CursorColor
func (p *DefaultPalette) CursorColor() color.NRGBA
CursorColor returns the text-cursor color.
func (*DefaultPalette) CursorTextColor
func (p *DefaultPalette) CursorTextColor() color.NRGBA
CursorTextColor returns the text color drawn under the cursor.
func (*DefaultPalette) DarkShadow
func (p *DefaultPalette) DarkShadow() color.NRGBA
DarkShadow returns the dark shadow color used in neumorphic rendering.
func (*DefaultPalette) DesktopBG
func (p *DefaultPalette) DesktopBG() color.NRGBA
DesktopBG returns the desktop background color.
func (*DefaultPalette) DisabledAlpha
func (p *DefaultPalette) DisabledAlpha() float64
DisabledAlpha returns the alpha multiplier applied to disabled controls.
func (*DefaultPalette) Highlight
func (p *DefaultPalette) Highlight() color.NRGBA
Highlight returns the highlight (accent) color.
func (*DefaultPalette) HighlightText
func (p *DefaultPalette) HighlightText() color.NRGBA
HighlightText returns the text color drawn on highlighted backgrounds.
func (*DefaultPalette) Icon
func (p *DefaultPalette) Icon() color.NRGBA
Icon returns the color used for icon glyphs.
func (*DefaultPalette) LightShadow
func (p *DefaultPalette) LightShadow() color.NRGBA
LightShadow returns the light highlight color used in neumorphic rendering.
func (*DefaultPalette) Link
func (p *DefaultPalette) Link() color.NRGBA
Link returns the color used for hyperlink text.
func (*DefaultPalette) Mid
func (p *DefaultPalette) Mid() color.NRGBA
Mid returns a color between Surface and DarkShadow.
func (*DefaultPalette) Midlight
func (p *DefaultPalette) Midlight() color.NRGBA
Midlight returns a color between Surface and LightShadow.
func (*DefaultPalette) PlaceholderText
func (p *DefaultPalette) PlaceholderText() color.NRGBA
PlaceholderText returns the color used for input placeholder text.
func (*DefaultPalette) SetDesktopBG
func (p *DefaultPalette) SetDesktopBG(c color.NRGBA)
SetDesktopBG sets the desktop background color. This color is carried by the palette (not derived from Surface) so the compositor and decoration renderer can reference it without a separate global. If the palette uses RB-swapped colors, pass the logical (R,G,B) color; the swap is applied automatically.
func (*DefaultPalette) Shadow
func (p *DefaultPalette) Shadow() color.NRGBA
Shadow returns a strong dark shadow color (near-black).
func (*DefaultPalette) Surface
func (p *DefaultPalette) Surface() color.NRGBA
Surface returns the primary surface (background) color.
func (*DefaultPalette) SurfaceTint
func (p *DefaultPalette) SurfaceTint() color.NRGBA
SurfaceTint returns the tinted surface color used for variant backgrounds.
func (*DefaultPalette) Text
func (p *DefaultPalette) Text() color.NRGBA
Text returns the primary text color.
func (*DefaultPalette) ToolTipBase
func (p *DefaultPalette) ToolTipBase() color.NRGBA
ToolTipBase returns the tooltip background color.
func (*DefaultPalette) ToolTipText
func (p *DefaultPalette) ToolTipText() color.NRGBA
ToolTipText returns the text color drawn on tooltips.
func (*DefaultPalette) WindowText
func (p *DefaultPalette) WindowText() color.NRGBA
WindowText returns the text color used in window decorations.
type DefaultTheme
DefaultTheme implements [mancini.Theme], combining a [mancini.Palette], [mancini.SurfaceStyle], [mancini.NeumorphicParams], geometry, and [mancini.FontResolver] into one value. It is the standard theme used by all interactors in mazzy/mazarin/mancini/std.
Create with NewDefaultTheme (standard purple palette) or NewTheme (fully customized).
type DefaultTheme struct {
// contains filtered or unexported fields
}
func NewDefaultTheme
func NewDefaultTheme(family string, defaultSize int64, resolve mancini.FontResolver) *DefaultTheme
NewDefaultTheme creates a Theme with the standard purple palette and default neumorphic parameters. resolve may be nil if font loading is not yet available.
The returned theme has no SurfaceStyle set — call DefaultTheme.SetStyle or use [std.NewDefaultTheme] which wires one up automatically.
func NewTheme
func NewTheme(pal mancini.Palette, neu mancini.NeumorphicParams, family string, defaultSize int64, resolve mancini.FontResolver) *DefaultTheme
NewTheme creates a fully customized Theme.
func (*DefaultTheme) BodyFontSize
func (t *DefaultTheme) BodyFontSize() int64
BodyFontSize returns the font size used for body text.
func (*DefaultTheme) ControlFontSize
func (t *DefaultTheme) ControlFontSize() int64
ControlFontSize returns the font size used for controls.
func (*DefaultTheme) ControlRadius
func (t *DefaultTheme) ControlRadius() float64
ControlRadius returns the corner radius used for buttons and similar controls.
func (*DefaultTheme) DefaultFont
func (t *DefaultTheme) DefaultFont() *mancini.FontConfig
DefaultFont returns a FontConfig for the theme’s default family and size using the None (regular) feature.
func (*DefaultTheme) DefaultFontSize
func (t *DefaultTheme) DefaultFontSize() int64
DefaultFontSize returns the theme’s default font size in pixels.
func (*DefaultTheme) FieldBorderWidth
func (t *DefaultTheme) FieldBorderWidth() float64
FieldBorderWidth returns the border width used for input fields.
func (*DefaultTheme) FieldPadding
func (t *DefaultTheme) FieldPadding() float64
FieldPadding returns the internal padding used for input fields.
func (*DefaultTheme) FieldRadius
func (t *DefaultTheme) FieldRadius() float64
FieldRadius returns the corner radius used for input fields.
func (*DefaultTheme) Font
func (t *DefaultTheme) Font(feature mancini.Feature, size int64) *mancini.FontConfig
Font returns a FontConfig whose LoadFace closure resolves the theme’s font family with the given feature and size. If no FontResolver was provided, LoadFace is nil and callers fall back to FontConfig’s built-in estimate.
func (*DefaultTheme) FontFamily
func (t *DefaultTheme) FontFamily() string
FontFamily returns the theme’s primary font family name.
func (*DefaultTheme) FontFamilyMono
func (t *DefaultTheme) FontFamilyMono() string
FontFamilyMono returns the theme’s monospace font family name.
func (*DefaultTheme) Name
func (t *DefaultTheme) Name() string
Name returns the theme’s display name.
func (*DefaultTheme) Neumorphic
func (t *DefaultTheme) Neumorphic() mancini.NeumorphicParams
Neumorphic returns the theme’s [mancini.NeumorphicParams].
func (*DefaultTheme) Palette
func (t *DefaultTheme) Palette() mancini.Palette
Palette returns the theme’s [mancini.Palette].
func (*DefaultTheme) ScrollbarMinThumb
func (t *DefaultTheme) ScrollbarMinThumb() float64
ScrollbarMinThumb returns the minimum scrollbar thumb length in pixels.
func (*DefaultTheme) ScrollbarThickness
func (t *DefaultTheme) ScrollbarThickness() float64
ScrollbarThickness returns the scrollbar’s cross-axis thickness in pixels.
func (*DefaultTheme) SetMonoFamily
func (t *DefaultTheme) SetMonoFamily(mono string)
SetMonoFamily sets the monospace font family name.
func (*DefaultTheme) SetName
func (t *DefaultTheme) SetName(name string)
SetName sets the theme’s display name.
func (*DefaultTheme) SetStyle
func (t *DefaultTheme) SetStyle(s mancini.SurfaceStyle)
SetStyle sets the active SurfaceStyle. This is called by [std.NewDefaultTheme] after construction, since the theme package cannot import std (where style implementations live).
func (*DefaultTheme) SmallFontSize
func (t *DefaultTheme) SmallFontSize() int64
SmallFontSize returns the font size used for small/secondary text.
func (*DefaultTheme) Style
func (t *DefaultTheme) Style() mancini.SurfaceStyle
Style returns the theme’s active [mancini.SurfaceStyle].
func (*DefaultTheme) TitleFontSize
func (t *DefaultTheme) TitleFontSize() int64
TitleFontSize returns the font size used for titles.
type DefaultWMTheme
DefaultWMTheme implements [mancini.WMTheme] with the default neumorphic decoration parameters matching rachel’s current hardcoded constants.
type DefaultWMTheme struct {
// contains filtered or unexported fields
}
func NewDefaultWMTheme
func NewDefaultWMTheme(pal mancini.Palette) *DefaultWMTheme
NewDefaultWMTheme creates a WMTheme with default decoration parameters. pal should be the RB-swapped palette used by rachel. style will be set via SetStyle after construction.
func (*DefaultWMTheme) ActiveBorderColor
func (t *DefaultWMTheme) ActiveBorderColor() color.NRGBA
ActiveBorderColor returns the border color for the focused window.
func (*DefaultWMTheme) BorderBottom
func (t *DefaultWMTheme) BorderBottom() int
BorderBottom returns the total bottom border width.
func (*DefaultWMTheme) BorderLeft
func (t *DefaultWMTheme) BorderLeft() int
BorderLeft returns the total left border width.
func (*DefaultWMTheme) BorderRight
func (t *DefaultWMTheme) BorderRight() int
BorderRight returns the total right border width.
func (*DefaultWMTheme) BorderTop
func (t *DefaultWMTheme) BorderTop() int
BorderTop returns the total top border width (shadow + title bar + gap).
func (*DefaultWMTheme) CornerRadius
func (t *DefaultWMTheme) CornerRadius() float64
CornerRadius returns the window corner radius in pixels.
func (*DefaultWMTheme) InactiveBorderColor
func (t *DefaultWMTheme) InactiveBorderColor() color.NRGBA
InactiveBorderColor returns the border color for unfocused windows.
func (*DefaultWMTheme) Name
func (t *DefaultWMTheme) Name() string
Name returns the WM theme’s display name.
func (*DefaultWMTheme) Palette
func (t *DefaultWMTheme) Palette() mancini.Palette
Palette returns the WM theme’s [mancini.Palette].
func (*DefaultWMTheme) RaisedLightAlpha
func (t *DefaultWMTheme) RaisedLightAlpha() uint8
RaisedLightAlpha returns the custom light shadow alpha for window decorations. Rachel uses 160 instead of the default 255 to avoid a visible white margin in the border zone.
func (*DefaultWMTheme) SetStyle
func (t *DefaultWMTheme) SetStyle(s mancini.SurfaceStyle)
SetStyle sets the active SurfaceStyle. Called by std after construction to break the theme→std import cycle.
func (*DefaultWMTheme) ShadowBottom
func (t *DefaultWMTheme) ShadowBottom() int
ShadowBottom returns the bottom shadow margin in pixels.
func (*DefaultWMTheme) ShadowLeft
func (t *DefaultWMTheme) ShadowLeft() int
ShadowLeft returns the left shadow margin in pixels.
func (*DefaultWMTheme) ShadowRight
func (t *DefaultWMTheme) ShadowRight() int
ShadowRight returns the right shadow margin in pixels.
func (*DefaultWMTheme) ShadowTop
func (t *DefaultWMTheme) ShadowTop() int
Shadow margins: left/right/bottom must be wide enough to contain the 12-pixel resize handle semi-circles (radius 12 + 2px groove margin = 14). Top is kept minimal since the title bar occupies that zone. ShadowTop returns the top shadow margin in pixels.
func (*DefaultWMTheme) Style
func (t *DefaultWMTheme) Style() mancini.SurfaceStyle
Style returns the WM theme’s active [mancini.SurfaceStyle].
func (*DefaultWMTheme) TitleActiveAlpha
func (t *DefaultWMTheme) TitleActiveAlpha() uint8
TitleActiveAlpha returns the title text alpha for focused windows.
func (*DefaultWMTheme) TitleBarHeight
func (t *DefaultWMTheme) TitleBarHeight() int
TitleBarHeight returns the title bar height in pixels.
func (*DefaultWMTheme) TitleFont
func (t *DefaultWMTheme) TitleFont() string
TitleFont returns the title bar font family name (empty = theme default).
func (*DefaultWMTheme) TitleFontSize
func (t *DefaultWMTheme) TitleFontSize() int64
TitleFontSize returns the title bar font size in pixels.
func (*DefaultWMTheme) TitleGap
func (t *DefaultWMTheme) TitleGap() int
TitleGap returns the gap in pixels between the title bar and the window content.
func (*DefaultWMTheme) TitleInactiveAlpha
func (t *DefaultWMTheme) TitleInactiveAlpha() uint8
TitleInactiveAlpha returns the title text alpha for unfocused windows.
func (*DefaultWMTheme) TitleStyle
func (t *DefaultWMTheme) TitleStyle() mancini.TitleBarStyle
TitleStyle returns the title bar style ([mancini.TitleBarStriped] by default).
func (*DefaultWMTheme) UnfocusedContentMode
func (t *DefaultWMTheme) UnfocusedContentMode() mancini.UnfocusedMode
UnfocusedContentMode returns how unfocused window content should be rendered.
func (*DefaultWMTheme) UnfocusedDimAlpha
func (t *DefaultWMTheme) UnfocusedDimAlpha() uint8
UnfocusedDimAlpha returns the dim alpha applied when unfocused content is dimmed.
func (*DefaultWMTheme) UrgentBorderColor
func (t *DefaultWMTheme) UrgentBorderColor() color.NRGBA
UrgentBorderColor returns the border color for windows requesting attention.
Generated by gomarkdoc