models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base16

type Base16 struct {
	Color0 ColorValue `json:"color_0"`
	Color1 ColorValue `json:"color_1"`
	Color2 ColorValue `json:"color_2"`
	Color3 ColorValue `json:"color_3"`
	Color4 ColorValue `json:"color_4"`
	Color5 ColorValue `json:"color_5"`
	Color6 ColorValue `json:"color_6"`
	Color7 ColorValue `json:"color_7"`
	Color8 ColorValue `json:"color_8"`
	Color9 ColorValue `json:"color_9"`
	ColorA ColorValue `json:"color_a"`
	ColorB ColorValue `json:"color_b"`
	ColorC ColorValue `json:"color_c"`
	ColorD ColorValue `json:"color_d"`
	ColorE ColorValue `json:"color_e"`
	ColorF ColorValue `json:"color_f"`
}

Base16 is 16 colors

func NewBase16

func NewBase16(colorMap map[string]color.ARGB) Base16

NewBase16 create Base16 from map of base16 color

type Case

type Case struct {
	// Snake case format (e.g., on_primary)
	Snake string `json:"snake"`
	// Camel case format (e.g., onPrimary)
	Camel string `json:"camel"`
	// Kebab case format (e.g., on-primary)
	Kebab string `json:"kebab"`
	// Pascal case format (e.g., OnPrimary)
	Pascal string `json:"pascal"`
}

Case holds different case variations of a color name.

func (Case) MarshalText

func (c Case) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler

func (Case) String

func (c Case) String() string

String implements fmt.Stringer

func (*Case) UnmarshalText

func (c *Case) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler

type Color

type Color struct {
	// Name represents the key of the color in various case styles.
	Name Case `json:"name"`
	// Color contains the different representations of the color value.
	Color ColorValue `json:"value"`
}

Color represents a named color with various color format representations.

func NewColor

func NewColor(key string, rgb color.ARGB) Color

NewColor creates a Color

type ColorValue

type ColorValue struct {
	// HexRGB is the RGB hexadecimal representation with '#' prefix (e.g., #FF0000)
	HexRGB string `json:"hex_rgb"`
	// TrimmedHexRGB is the RGB hexadecimal representation without '#' (e.g., FF0000)
	TrimmedHexRGB string `json:"trimmed_hex_rgb"`
	// HexRGBA is the RGBA hexadecimal representation with '#' prefix (e.g., #FF0000FF)
	HexRGBA string `json:"hex_rgba"`
	// TrimmedHexRGBA is the RGBA hexadecimal representation without '#' (e.g., FF0000FF)
	TrimmedHexRGBA string `json:"trimmed_hex_rgba"`
	// RGB is the RGB string format with values 0–255 (e.g., rgb(0,255,0))
	RGB string `json:"rgb"`
	// TrimmedRGB is the comma-separated RGB values 0–255 without the "rgb(...)" wrapper (e.g., 0,255,0)
	TrimmedRGB string `json:"trimmed_rgb"`
	// RGBA is the RGBA string format with values 0–255 (e.g., rgba(0,255,0,255))
	RGBA string `json:"rgba"`
	// TrimmedRGBA is the comma-separated RGBA values 0–255 without the "rgba(...)" wrapper (e.g., 0,255,0,255)
	TrimmedRGBA string `json:"trimmed_rgba"`
	// LinearRGB is the RGB string format with values in 0–1 range (e.g., rgb(0,1,0))
	LinearRGB string `json:"linear_rgb"`
	// TrimmedLinearRGB is the comma-separated RGB values in 0–1 range (e.g., 0,1,0)
	TrimmedLinearRGB string `json:"trimmed_linear_rgb"`
	// LinearRGBA is the RGBA string format with values in 0–1 range (e.g., rgba(0,1,0,1))
	LinearRGBA string `json:"linear_rgba"`
	// TrimmedLinearRGBA is the comma-separated RGBA values in 0–1 range (e.g., 0,1,0,1)
	TrimmedLinearRGBA string `json:"trimmed_linear_rgba"`
	// AnsiColor is the terminals ansi sequence without the escape character (e.g., 38;2;1;2;3)
	AnsiForeground string `json:"ansi_foreground"`
	// AnsiColor is the terminals ansi sequence without the escape character (e.g., 48;2;1;2;3)
	AnsiBackground string `json:"ansi_background"`

	// Red channel value (0–255)
	Red uint8 `json:"red"`
	// Green channel value (0–255)
	Green uint8 `json:"green"`
	// Blue channel value (0–255)
	Blue uint8 `json:"blue"`
	// Alpha channel value (0–255)
	Alpha uint8 `json:"alpha"`

	Int color.ARGB
}

ColorValue stores a color in multiple string and numeric formats.

func NewColorValue

func NewColorValue(rgb color.ARGB) ColorValue

NewColorValue create a ColorValue

func (ColorValue) String

func (cv ColorValue) String() string

String is useful when using .NameValue. It will be converted to "#XXXXXX".

type Material

type Material struct {
	Background              ColorValue `json:"background"                 toml:"background"`
	Error                   ColorValue `json:"error"                      toml:"error"`
	ErrorContainer          ColorValue `json:"error_container"            toml:"error_container"`
	InverseOnSurface        ColorValue `json:"inverse_on_surface"         toml:"inverse_on_surface"`
	InversePrimary          ColorValue `json:"inverse_primary"            toml:"inverse_primary"`
	InverseSurface          ColorValue `json:"inverse_surface"            toml:"inverse_surface"`
	OnBackground            ColorValue `json:"on_background"              toml:"on_background"`
	OnError                 ColorValue `json:"on_error"                   toml:"on_error"`
	OnErrorContainer        ColorValue `json:"on_error_container"         toml:"on_error_container"`
	OnPrimary               ColorValue `json:"on_primary"                 toml:"on_primary"`
	OnPrimaryContainer      ColorValue `json:"on_primary_container"       toml:"on_primary_container"`
	OnPrimaryFixed          ColorValue `json:"on_primary_fixed"           toml:"on_primary_fixed"`
	OnPrimaryFixedVariant   ColorValue `json:"on_primary_fixed_variant"   toml:"on_primary_fixed_variant"`
	OnSecondary             ColorValue `json:"on_secondary"               toml:"on_secondary"`
	OnSecondaryContainer    ColorValue `json:"on_secondary_container"     toml:"on_secondary_container"`
	OnSecondaryFixed        ColorValue `json:"on_secondary_fixed"         toml:"on_secondary_fixed"`
	OnSecondaryFixedVariant ColorValue `json:"on_secondary_fixed_variant" toml:"on_secondary_fixed_variant"`
	OnSurface               ColorValue `json:"on_surface"                 toml:"on_surface"`
	OnSurfaceVariant        ColorValue `json:"on_surface_variant"         toml:"on_surface_variant"`
	OnTertiary              ColorValue `json:"on_tertiary"                toml:"on_tertiary"`
	OnTertiaryContainer     ColorValue `json:"on_tertiary_container"      toml:"on_tertiary_container"`
	OnTertiaryFixed         ColorValue `json:"on_tertiary_fixed"          toml:"on_tertiary_fixed"`
	OnTertiaryFixedVariant  ColorValue `json:"on_tertiary_fixed_variant"  toml:"on_tertiary_fixed_variant"`
	Outline                 ColorValue `json:"outline"                    toml:"outline"`
	OutlineVariant          ColorValue `json:"outline_variant"            toml:"outline_variant"`
	Primary                 ColorValue `json:"primary"                    toml:"primary"`
	PrimaryContainer        ColorValue `json:"primary_container"          toml:"primary_container"`
	PrimaryFixed            ColorValue `json:"primary_fixed"              toml:"primary_fixed"`
	PrimaryFixedDim         ColorValue `json:"primary_fixed_dim"          toml:"primary_fixed_dim"`
	Scrim                   ColorValue `json:"scrim"                      toml:"scrim"`
	Secondary               ColorValue `json:"secondary"                  toml:"secondary"`
	SecondaryContainer      ColorValue `json:"secondary_container"        toml:"secondary_container"`
	SecondaryFixed          ColorValue `json:"secondary_fixed"            toml:"secondary_fixed"`
	SecondaryFixedDim       ColorValue `json:"secondary_fixed_dim"        toml:"secondary_fixed_dim"`
	Shadow                  ColorValue `json:"shadow"                     toml:"shadow"`
	Surface                 ColorValue `json:"surface"                    toml:"surface"`
	SurfaceBright           ColorValue `json:"surface_bright"             toml:"surface_bright"`
	SurfaceContainer        ColorValue `json:"surface_container"          toml:"surface_container"`
	SurfaceContainerHigh    ColorValue `json:"surface_container_high"     toml:"surface_container_high"`
	SurfaceContainerHighest ColorValue `json:"surface_container_highest"  toml:"surface_container_highest"`
	SurfaceContainerLow     ColorValue `json:"surface_container_low"      toml:"surface_container_low"`
	SurfaceContainerLowest  ColorValue `json:"surface_container_lowest"   toml:"surface_container_lowest"`
	SurfaceDim              ColorValue `json:"surface_dim"                toml:"surface_dim"`
	SurfaceTint             ColorValue `json:"surface_tint"               toml:"surface_tint"`
	SurfaceVariant          ColorValue `json:"surface_variant"            toml:"surface_variant"`
	Tertiary                ColorValue `json:"tertiary"                   toml:"tertiary"`
	TertiaryContainer       ColorValue `json:"tertiary_container"         toml:"tertiary_container"`
	TertiaryFixed           ColorValue `json:"tertiary_fixed"             toml:"tertiary_fixed"`
	TertiaryFixedDim        ColorValue `json:"tertiary_fixed_dim"         toml:"tertiary_fixed_dim"`
}

Material contains all material colors

func NewMaterial

func NewMaterial(colorMap map[string]color.ARGB) Material

NewMaterial return material color type

type Output

type Output struct {
	Material `        json:"material"`
	Base16   `        json:"base16"`
	Image    string  `json:"image"`
	Colors   []Color `json:"colors"`
}

Output contains all values that will execute templates

func NewOutput

func NewOutput(
	source string,
	base16 map[string]color.ARGB,
	colorMap map[string]color.ARGB,
) Output

NewOutput create output struct for templates execution

Jump to

Keyboard shortcuts

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