theming

package
v0.0.0-...-6902453 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Context = contextutil.New[Theming]()
View Source
var DefaultColorScheme = ColorSchemeFrom(f32color.RGB(0x6750A4))
View Source
var DefaultTypography = NewTypography()

Functions

func WithColorScheme

func WithColorScheme(colorScheme ColorScheme) func(opt *theming)

func WithTypography

func WithTypography(typography Typography) func(opt *theming)

Types

type ColorScheme

type ColorScheme interface {
	Color(role colorrole.ColorRole) color.NRGBA
}

func ColorSchemeFrom

func ColorSchemeFrom(primaryKeyColor color.Color, optionFns ...ColorSchemeOptionFunc) ColorScheme

type ColorSchemeOptionFunc

type ColorSchemeOptionFunc func(p *palette)

func AsDarkMode

func AsDarkMode() ColorSchemeOptionFunc

func WithCustomKeyColor

func WithCustomKeyColor(role colorrole.ColorRole, keyColor color.Color) ColorSchemeOptionFunc

func WithNeutralKeyColor

func WithNeutralKeyColor(keyColor color.Color) ColorSchemeOptionFunc

func WithNeutralVariantKeyColor

func WithNeutralVariantKeyColor(keyColor color.Color) ColorSchemeOptionFunc

func WithSecondaryKeyColor

func WithSecondaryKeyColor(keyColor color.Color) ColorSchemeOptionFunc

func WithTertiaryKeyColor

func WithTertiaryKeyColor(keyColor color.Color) ColorSchemeOptionFunc

type FontProvider

type FontProvider interface {
	Font(font font.Font) string
}

type Fonts

type Fonts map[font.Font][]string

type OptionFunc

type OptionFunc = func(opt *theming)

type Theming

type Theming interface {
	Typography
	ColorScheme
}

func New

func New(optFns ...OptionFunc) Theming

type TonalPalette

type TonalPalette interface {
	Toned(tone float32) color.Color
}

func TonalPaletteFromHueAndChroma

func TonalPaletteFromHueAndChroma(hue, chroma float32) TonalPalette

type TypeScales

type TypeScales map[typescale.TypeScale]text.Style

func CreateDefaultTypeScales

func CreateDefaultTypeScales(fp FontProvider) TypeScales

type Typography

type Typography interface {
	FontProvider
	TypeScale(typeScale typescale.TypeScale) text.Style
}

func NewTypography

func NewTypography(opts ...TypographyOptionFunc) Typography

type TypographyOptionFunc

type TypographyOptionFunc func(t *typography)

func WithFonts

func WithFonts(fonts Fonts) TypographyOptionFunc

func WithTypeScales

func WithTypeScales(create func(fp FontProvider) TypeScales) TypographyOptionFunc

Jump to

Keyboard shortcuts

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