View on GitHub

Mazarin

All-Go Operating System For ARM64, RISC-V and x86_64

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

DefaultNeumorphicParams implements [mancini.NeumorphicParams] with two parameter sets:

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

func (*DefaultNeumorphicParams) Light

func (d *DefaultNeumorphicParams) Light() *mancini.NeuParams

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 swapped (for framebuffers that use BGR byte order).

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) DarkShadow

func (p *DefaultPalette) DarkShadow() color.NRGBA

func (*DefaultPalette) DisabledAlpha

func (p *DefaultPalette) DisabledAlpha() float64

func (*DefaultPalette) Highlight

func (p *DefaultPalette) Highlight() color.NRGBA

func (*DefaultPalette) HighlightText

func (p *DefaultPalette) HighlightText() color.NRGBA

func (*DefaultPalette) Icon

func (p *DefaultPalette) Icon() color.NRGBA

func (*DefaultPalette) LightShadow

func (p *DefaultPalette) LightShadow() color.NRGBA

func (*DefaultPalette) Surface

func (p *DefaultPalette) Surface() color.NRGBA

func (*DefaultPalette) SurfaceTint

func (p *DefaultPalette) SurfaceTint() color.NRGBA

func (*DefaultPalette) SwapRB

func (p *DefaultPalette) SwapRB() bool

func (*DefaultPalette) Text

func (p *DefaultPalette) Text() color.NRGBA

type DefaultTheme

DefaultTheme implements [mancini.Theme], combining a [mancini.Palette], [mancini.NeumorphicParams], 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.

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) 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

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) Neumorphic

func (t *DefaultTheme) Neumorphic() mancini.NeumorphicParams

func (*DefaultTheme) Palette

func (t *DefaultTheme) Palette() mancini.Palette

Generated by gomarkdoc