Documentation
¶
Index ¶
- Constants
- type Colors
- type CustomColor
- type CustomColorOption
- type Option
- func WithContext(ctx context.Context) Option
- func WithContrast(c float64) Option
- func WithCustomColor(name string, c gocolor.Color) Option
- func WithCustomColorBlend(name string, c gocolor.Color, ratio float64) Option
- func WithDark(d bool) Option
- func WithPlatform(p dynamic.Platform) Option
- func WithSettings(s Settings) Option
- func WithVariant(v dynamic.Variant) Option
- func WithVersion(v dynamic.Version) Option
- type Settings
- type Source
- func Combine(sources ...Source) Source
- func Filter(source Source, predicate func(color.ARGB) bool) Source
- func FromARGB(argbs []color.ARGB) Source
- func FromBytes(b []byte) Source
- func FromColor(c gocolor.Color) Source
- func FromColors(s []gocolor.Color) Source
- func FromHex(hex string) Source
- func FromHexes(hexes []string) Source
- func FromImage(img image.Image) Source
- func FromReader(r io.Reader) Source
Examples ¶
Constants ¶
const ( // PlatformPhone is a Platform of type Phone. PlatformPhone = dynamic.PlatformPhone // PlatformWatch is a Platform of type Watch. PlatformWatch = dynamic.PlatformWatch // VariantMonochrome is a Variant of type Monochrome. VariantMonochrome = dynamic.VariantMonochrome // VariantNeutral is a Variant of type Neutral. VariantNeutral = dynamic.VariantNeutral // VariantTonalSpot is a Variant of type Tonal_spot. VariantTonalSpot = dynamic.VariantTonalSpot // VariantVibrant is a Variant of type Vibrant. VariantVibrant = dynamic.VariantVibrant // VariantExpressive is a Variant of type Expressive. VariantExpressive = dynamic.VariantExpressive // VariantFidelity is a Variant of type Fidelity. VariantFidelity = dynamic.VariantFidelity // VariantContent is a Variant of type Content. VariantContent = dynamic.VariantContent // VariantRainbow is a Variant of type Rainbow. VariantRainbow = dynamic.VariantRainbow // VariantFruitSalad is a Variant of type Fruit_salad. VariantFruitSalad = dynamic.VariantFruitSalad // Version2021 is a Version of type 2021. Version2021 = dynamic.Version2021 // Version2025 is a Version of type 2025. Version2025 = dynamic.Version2025 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Colors ¶
type Colors struct {
Scheme *dynamic.Scheme `json:"scheme,omitzero"`
CustomColors map[string]CustomColor `json:"custom"`
Background color.ARGB `json:"background"`
Error color.ARGB `json:"error"`
ErrorContainer color.ARGB `json:"error_container"`
ErrorDim color.ARGB `json:"error_dim"`
InverseOnSurface color.ARGB `json:"inverse_on_surface"`
InversePrimary color.ARGB `json:"inverse_primary"`
InverseSurface color.ARGB `json:"inverse_surface"`
OnBackground color.ARGB `json:"on_background"`
OnError color.ARGB `json:"on_error"`
OnErrorContainer color.ARGB `json:"on_error_container"`
OnPrimary color.ARGB `json:"on_primary"`
OnPrimaryContainer color.ARGB `json:"on_primary_container"`
OnPrimaryFixed color.ARGB `json:"on_primary_fixed"`
OnPrimaryFixedVariant color.ARGB `json:"on_primary_fixed_variant"`
OnSecondary color.ARGB `json:"on_secondary"`
OnSecondaryContainer color.ARGB `json:"on_secondary_container"`
OnSecondaryFixed color.ARGB `json:"on_secondary_fixed"`
OnSecondaryFixedVariant color.ARGB `json:"on_secondary_fixed_variant"`
OnSurface color.ARGB `json:"on_surface"`
OnSurfaceVariant color.ARGB `json:"on_surface_variant"`
OnTertiary color.ARGB `json:"on_tertiary"`
OnTertiaryContainer color.ARGB `json:"on_tertiary_container"`
OnTertiaryFixed color.ARGB `json:"on_tertiary_fixed"`
OnTertiaryFixedVariant color.ARGB `json:"on_tertiary_fixed_variant"`
Outline color.ARGB `json:"outline"`
OutlineVariant color.ARGB `json:"outline_variant"`
Primary color.ARGB `json:"primary"`
PrimaryContainer color.ARGB `json:"primary_container"`
PrimaryDim color.ARGB `json:"primary_dim"`
PrimaryFixed color.ARGB `json:"primary_fixed"`
PrimaryFixedDim color.ARGB `json:"primary_fixed_dim"`
Scrim color.ARGB `json:"scrim"`
Secondary color.ARGB `json:"secondary"`
SecondaryContainer color.ARGB `json:"secondary_container"`
SecondaryDim color.ARGB `json:"secondary_dim"`
SecondaryFixed color.ARGB `json:"secondary_fixed"`
SecondaryFixedDim color.ARGB `json:"secondary_fixed_dim"`
Shadow color.ARGB `json:"shadow"`
Surface color.ARGB `json:"surface"`
SurfaceBright color.ARGB `json:"surface_bright"`
SurfaceContainer color.ARGB `json:"surface_container"`
SurfaceContainerHigh color.ARGB `json:"surface_container_high"`
SurfaceContainerHighest color.ARGB `json:"surface_container_highest"`
SurfaceContainerLow color.ARGB `json:"surface_container_low"`
SurfaceContainerLowest color.ARGB `json:"surface_container_lowest"`
SurfaceDim color.ARGB `json:"surface_dim"`
SurfaceTint color.ARGB `json:"surface_tint"`
SurfaceVariant color.ARGB `json:"surface_variant"`
Tertiary color.ARGB `json:"tertiary"`
TertiaryContainer color.ARGB `json:"tertiary_container"`
TertiaryDim color.ARGB `json:"tertiary_dim"`
TertiaryFixed color.ARGB `json:"tertiary_fixed"`
TertiaryFixedDim color.ARGB `json:"tertiary_fixed_dim"`
// contains filtered or unexported fields
}
Colors is generated material you colors
type CustomColor ¶
type CustomColor struct {
Color color.ARGB `json:"color"`
OnColor color.ARGB `json:"on_color"`
ColorContainer color.ARGB `json:"color_container"`
OnColorContainer color.ARGB `json:"on_color_container"`
}
CustomColor is the custom colors generated from user defined colors
type CustomColorOption ¶
CustomColorOption is used define custom color
type Option ¶
type Option func(s *Settings)
Option is a func modifes the dynamic scheme settings
func WithContext ¶
WithContext returns an Option that set the context
func WithContrast ¶
WithContrast returns an Option that sets the contrast level
func WithCustomColor ¶
WithCustomColor returns an Option that adds a custom color.
func WithCustomColorBlend ¶
WithCustomColorBlend returns an Option that adds a custom color which will be blended with primary color by geven ratio. Ratio range [0, 1].
func WithPlatform ¶
WithPlatform returns an Option that sets the platform
func WithSettings ¶
WithSettings settings all values of settings
func WithVariant ¶
WithVariant returns an Option that sets the variant
func WithVersion ¶
WithVersion returns an Option that sets the version
type Settings ¶
type Settings struct {
Context context.Context `json:"-"` // context shouldn't be encoded
Contrast float64 `json:"contrast"`
Dark bool `json:"dark"`
Platform dynamic.Platform `json:"platform"`
Variant dynamic.Variant `json:"variant"`
Version dynamic.Version `json:"version"`
Custom map[string]CustomColorOption `json:"-"`
}
Settings is the dynamic schema configuration
type Source ¶
Source is a function that returns source colors for material you
func FromBytes ¶
FromBytes returns Source colors from a byte slice.
WARNING: DO NOT pass image encoded file buffer. byte slice should be a sequence of r, g, b bytes (3 bytes per color).
func FromColors ¶
FromColors returns a Source from a slice of color.Color interfaces
func FromReader ¶
FromReader returns Source colors from an io.Reader containing RGB bytes. Reads until EOF and extracts RGB triplets from the stream.
WARNING: Do NOT pass image encoded file readers (e.g., PNG, JPEG). Use FromImage with image.Decode for encoded image files.