Documentation
¶
Index ¶
- Variables
- func EnableLightForeground(tone float64) float64
- func FindDesiredChromaByTone(hue, chroma, tone float64, byDecreasingTone bool) float64
- func ForegroundTone(bgTone, ratio float64) float64
- func GetPiecewiseHue(sourceColorHct color.Hct, hueBreakpoints []float64, hues []float64) float64
- func GetRotatedHue(sourceColorHct color.Hct, hueBreakpoints []float64, rotations []float64) float64
- func IsFidelity(scheme *DynamicScheme) bool
- func IsMonochrome(scheme *DynamicScheme) bool
- func ToneAllowsLightForeground(tone float64) bool
- func TonePrefersLightForeground(tone float64) bool
- type ChromaMultiplier
- type ColorCalculationDelegate
- type ContrastCurve
- type ContrastCurveFn
- type DeltaConstraint
- type DynamicColor
- type DynamicColorFn
- type DynamicScheme
- type DynamicSchemeFn
- type DynamicSchemePalettesDelegate
- type DynamicSchemePalettesDelegateImpl2021
- func (d *DynamicSchemePalettesDelegateImpl2021) GetErrorPalette(variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, ...) *palettes.TonalPalette
- func (d *DynamicSchemePalettesDelegateImpl2021) GetNeutralPalette(variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, ...) *palettes.TonalPalette
- func (d *DynamicSchemePalettesDelegateImpl2021) GetNeutralVariantPalette(variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, ...) *palettes.TonalPalette
- func (d *DynamicSchemePalettesDelegateImpl2021) GetPrimaryPalette(variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, ...) *palettes.TonalPalette
- func (d *DynamicSchemePalettesDelegateImpl2021) GetSecondaryPalette(variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, ...) *palettes.TonalPalette
- func (d *DynamicSchemePalettesDelegateImpl2021) GetTertiaryPalette(variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, ...) *palettes.TonalPalette
- type DynamicSchemePalettesDelegateImpl2025
- func (d *DynamicSchemePalettesDelegateImpl2025) GetErrorPalette(variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, ...) *palettes.TonalPalette
- func (d *DynamicSchemePalettesDelegateImpl2025) GetNeutralPalette(variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, ...) *palettes.TonalPalette
- func (d *DynamicSchemePalettesDelegateImpl2025) GetNeutralVariantPalette(variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, ...) *palettes.TonalPalette
- func (d *DynamicSchemePalettesDelegateImpl2025) GetPrimaryPalette(variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, ...) *palettes.TonalPalette
- func (d *DynamicSchemePalettesDelegateImpl2025) GetSecondaryPalette(variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, ...) *palettes.TonalPalette
- func (d *DynamicSchemePalettesDelegateImpl2025) GetTertiaryPalette(variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, ...) *palettes.TonalPalette
- type MaterialColorSpec
- type MaterialSpec2021
- func (m MaterialSpec2021) Background() *DynamicColor
- func (m MaterialSpec2021) Error() *DynamicColor
- func (m MaterialSpec2021) ErrorContainer() *DynamicColor
- func (m MaterialSpec2021) ErrorDim() *DynamicColor
- func (m MaterialSpec2021) HighestSurface(s *DynamicScheme) *DynamicColor
- func (m MaterialSpec2021) InverseOnSurface() *DynamicColor
- func (m MaterialSpec2021) InversePrimary() *DynamicColor
- func (m MaterialSpec2021) InverseSurface() *DynamicColor
- func (m MaterialSpec2021) NeutralPaletteKeyColor() *DynamicColor
- func (m MaterialSpec2021) NeutralVariantPaletteKeyColor() *DynamicColor
- func (m MaterialSpec2021) OnBackground() *DynamicColor
- func (m MaterialSpec2021) OnError() *DynamicColor
- func (m MaterialSpec2021) OnErrorContainer() *DynamicColor
- func (m MaterialSpec2021) OnPrimary() *DynamicColor
- func (m MaterialSpec2021) OnPrimaryContainer() *DynamicColor
- func (m MaterialSpec2021) OnPrimaryFixed() *DynamicColor
- func (m MaterialSpec2021) OnPrimaryFixedVariant() *DynamicColor
- func (m MaterialSpec2021) OnSecondary() *DynamicColor
- func (m MaterialSpec2021) OnSecondaryContainer() *DynamicColor
- func (m MaterialSpec2021) OnSecondaryFixed() *DynamicColor
- func (m MaterialSpec2021) OnSecondaryFixedVariant() *DynamicColor
- func (m MaterialSpec2021) OnSurface() *DynamicColor
- func (m MaterialSpec2021) OnSurfaceVariant() *DynamicColor
- func (m MaterialSpec2021) OnTertiary() *DynamicColor
- func (m MaterialSpec2021) OnTertiaryContainer() *DynamicColor
- func (m MaterialSpec2021) OnTertiaryFixed() *DynamicColor
- func (m MaterialSpec2021) OnTertiaryFixedVariant() *DynamicColor
- func (m MaterialSpec2021) Outline() *DynamicColor
- func (m MaterialSpec2021) OutlineVariant() *DynamicColor
- func (m MaterialSpec2021) Primary() *DynamicColor
- func (m MaterialSpec2021) PrimaryContainer() *DynamicColor
- func (m MaterialSpec2021) PrimaryDim() *DynamicColor
- func (m MaterialSpec2021) PrimaryFixed() *DynamicColor
- func (m MaterialSpec2021) PrimaryFixedDim() *DynamicColor
- func (m MaterialSpec2021) PrimaryPaletteKeyColor() *DynamicColor
- func (m MaterialSpec2021) Scrim() *DynamicColor
- func (m MaterialSpec2021) Secondary() *DynamicColor
- func (m MaterialSpec2021) SecondaryContainer() *DynamicColor
- func (m MaterialSpec2021) SecondaryDim() *DynamicColor
- func (m MaterialSpec2021) SecondaryFixed() *DynamicColor
- func (m MaterialSpec2021) SecondaryFixedDim() *DynamicColor
- func (m MaterialSpec2021) SecondaryPaletteKeyColor() *DynamicColor
- func (m MaterialSpec2021) Shadow() *DynamicColor
- func (m MaterialSpec2021) Surface() *DynamicColor
- func (m MaterialSpec2021) SurfaceBright() *DynamicColor
- func (m MaterialSpec2021) SurfaceContainer() *DynamicColor
- func (m MaterialSpec2021) SurfaceContainerHigh() *DynamicColor
- func (m MaterialSpec2021) SurfaceContainerHighest() *DynamicColor
- func (m MaterialSpec2021) SurfaceContainerLow() *DynamicColor
- func (m MaterialSpec2021) SurfaceContainerLowest() *DynamicColor
- func (m MaterialSpec2021) SurfaceDim() *DynamicColor
- func (m MaterialSpec2021) SurfaceTint() *DynamicColor
- func (m MaterialSpec2021) SurfaceVariant() *DynamicColor
- func (m MaterialSpec2021) Tertiary() *DynamicColor
- func (m MaterialSpec2021) TertiaryContainer() *DynamicColor
- func (m MaterialSpec2021) TertiaryDim() *DynamicColor
- func (m MaterialSpec2021) TertiaryFixed() *DynamicColor
- func (m MaterialSpec2021) TertiaryFixedDim() *DynamicColor
- func (m MaterialSpec2021) TertiaryPaletteKeyColor() *DynamicColor
- type MaterialSpec2025
- func (m MaterialSpec2025) Error() *DynamicColor
- func (m MaterialSpec2025) ErrorContainer() *DynamicColor
- func (m MaterialSpec2025) ErrorDim() *DynamicColor
- func (m MaterialSpec2025) InverseOnSurface() *DynamicColor
- func (m MaterialSpec2025) InversePrimary() *DynamicColor
- func (m MaterialSpec2025) InverseSurface() *DynamicColor
- func (m MaterialSpec2025) OnError() *DynamicColor
- func (m MaterialSpec2025) OnErrorContainer() *DynamicColor
- func (m MaterialSpec2025) OnPrimary() *DynamicColor
- func (m MaterialSpec2025) OnPrimaryContainer() *DynamicColor
- func (m MaterialSpec2025) OnPrimaryFixed() *DynamicColor
- func (m MaterialSpec2025) OnPrimaryFixedVariant() *DynamicColor
- func (m MaterialSpec2025) OnSecondary() *DynamicColor
- func (m MaterialSpec2025) OnSecondaryContainer() *DynamicColor
- func (m MaterialSpec2025) OnSecondaryFixed() *DynamicColor
- func (m MaterialSpec2025) OnSecondaryFixedVariant() *DynamicColor
- func (m MaterialSpec2025) OnSurface() *DynamicColor
- func (m MaterialSpec2025) OnSurfaceVariant() *DynamicColor
- func (m MaterialSpec2025) OnTertiary() *DynamicColor
- func (m MaterialSpec2025) OnTertiaryContainer() *DynamicColor
- func (m MaterialSpec2025) OnTertiaryFixed() *DynamicColor
- func (m MaterialSpec2025) OnTertiaryFixedVariant() *DynamicColor
- func (m MaterialSpec2025) Outline() *DynamicColor
- func (m MaterialSpec2025) OutlineVariant() *DynamicColor
- func (m MaterialSpec2025) Primary() *DynamicColor
- func (m MaterialSpec2025) PrimaryContainer() *DynamicColor
- func (m MaterialSpec2025) PrimaryDim() *DynamicColor
- func (m MaterialSpec2025) PrimaryFixed() *DynamicColor
- func (m MaterialSpec2025) PrimaryFixedDim() *DynamicColor
- func (m MaterialSpec2025) Secondary() *DynamicColor
- func (m MaterialSpec2025) SecondaryContainer() *DynamicColor
- func (m MaterialSpec2025) SecondaryDim() *DynamicColor
- func (m MaterialSpec2025) SecondaryFixed() *DynamicColor
- func (m MaterialSpec2025) SecondaryFixedDim() *DynamicColor
- func (m MaterialSpec2025) Surface() *DynamicColor
- func (m MaterialSpec2025) SurfaceBright() *DynamicColor
- func (m MaterialSpec2025) SurfaceContainer() *DynamicColor
- func (m MaterialSpec2025) SurfaceContainerHigh() *DynamicColor
- func (m MaterialSpec2025) SurfaceContainerHighest() *DynamicColor
- func (m MaterialSpec2025) SurfaceContainerLow() *DynamicColor
- func (m MaterialSpec2025) SurfaceContainerLowest() *DynamicColor
- func (m MaterialSpec2025) SurfaceDim() *DynamicColor
- func (m MaterialSpec2025) Tertiary() *DynamicColor
- func (m MaterialSpec2025) TertiaryContainer() *DynamicColor
- func (m MaterialSpec2025) TertiaryDim() *DynamicColor
- func (m MaterialSpec2025) TertiaryFixed() *DynamicColor
- func (m MaterialSpec2025) TertiaryFixedDim() *DynamicColor
- type Platform
- type TonalPaletteFn
- type ToneDeltaPair
- type ToneDeltaPairFn
- type ToneFn
- type TonePolarity
- type Variant
- type Version
Constants ¶
This section is empty.
Variables ¶
var ColorCalculation2021 = colorCalculationDelegateImpl2021{}
var ColorCalculation2025 = colorCalculationDelegateImpl2025{}
var ErrInvalidDeltaConstraint = errors.New("not a valid DeltaConstraint")
var ErrInvalidPlatform = errors.New("not a valid Platform")
var ErrInvalidTonePolarity = errors.New("not a valid TonePolarity")
var ErrInvalidVariant = errors.New("not a valid Variant")
var ErrInvalidVersion = errors.New("not a valid Version")
Functions ¶
func EnableLightForeground ¶
EnableLightForeground adjusts a tone to enable light foreground if needed
func FindDesiredChromaByTone ¶
FindDesiredChromaByTone finds a tone where the chroma is as close as possible to the requested value
func ForegroundTone ¶
ForegroundTone calculates a foreground tone that has sufficient contrast with a background tone
func GetPiecewiseHue ¶
GetPiecewiseHue returns a new hue based on a piece wise function and the input color's hue.
func GetRotatedHue ¶
GetRotatedHue returns a shifted hue based on a piece wise function and the input hue.
func IsFidelity ¶
func IsFidelity(scheme *DynamicScheme) bool
IsFidelity returns whether the scheme is a fidelity scheme
func IsMonochrome ¶
func IsMonochrome(scheme *DynamicScheme) bool
IsMonochrome returns whether the scheme is monochrome
func ToneAllowsLightForeground ¶
ToneAllowsLightForeground determines if a tone allows light foreground
func TonePrefersLightForeground ¶
TonePrefersLightForeground determines if a tone prefers light foreground
Types ¶
type ChromaMultiplier ¶
type ChromaMultiplier func(s *DynamicScheme) float64
Function type definitions
type ColorCalculationDelegate ¶
type ColorCalculationDelegate interface {
GetHct(scheme *DynamicScheme, color *DynamicColor) color.Hct
GetTone(scheme *DynamicScheme, color *DynamicColor) float64
}
type ContrastCurve ¶
type ContrastCurve struct {
// contains filtered or unexported fields
}
ContrastCurve represents a curve that provides contrast values based on contrast level
func GetCurve ¶
func GetCurve(defaultContrast float64) *ContrastCurve
GetCurve returns the contrast curve for a given default contrast.
func NewContrastCurve ¶
func NewContrastCurve(low, normal, medium, high float64) *ContrastCurve
NewContrastCurve creates a new NewContrastCurve with the specified values low: Value for contrast level -1.0 normal: Value for contrast level 0.0 medium: Value for contrast level 0.5 high: Value for contrast level 1.0
func (*ContrastCurve) Get ¶
func (c *ContrastCurve) Get(contrastLevel float64) float64
Get returns the value at a given contrast level contrastLevel: The contrast level. 0.0 is the default (normal); -1.0 is the lowest; 1.0 is the highest. return: The value. For contrast ratios, a number between 1.0 and 21.0.
type ContrastCurveFn ¶
type ContrastCurveFn func(s *DynamicScheme) *ContrastCurve
Function type definitions
type DeltaConstraint ¶
type DeltaConstraint uint
DeltaConstraint describes how to fulfill a tone delta pair constraint.
ENUM(constraint_exact, constraint_nearer, constraint_farther)
const ( // ConstraintExact is a DeltaConstraint of type Constraint_exact. ConstraintExact DeltaConstraint = iota // ConstraintNearer is a DeltaConstraint of type Constraint_nearer. ConstraintNearer // ConstraintFarther is a DeltaConstraint of type Constraint_farther. ConstraintFarther )
func ParseDeltaConstraint ¶
func ParseDeltaConstraint(name string) (DeltaConstraint, error)
ParseDeltaConstraint attempts to convert a string to a DeltaConstraint.
func (*DeltaConstraint) AppendText ¶
func (x *DeltaConstraint) AppendText(b []byte) ([]byte, error)
AppendText appends the textual representation of itself to the end of b (allocating a larger slice if necessary) and returns the updated slice.
Implementations must not retain b, nor mutate any bytes within b[:len(b)].
func (DeltaConstraint) IsValid ¶
func (x DeltaConstraint) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (DeltaConstraint) MarshalText ¶
func (x DeltaConstraint) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (DeltaConstraint) String ¶
func (x DeltaConstraint) String() string
String implements the Stringer interface.
func (*DeltaConstraint) UnmarshalText ¶
func (x *DeltaConstraint) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type DynamicColor ¶
type DynamicColor struct {
Name string
Palette TonalPaletteFn
Tone ToneFn
ChromaMultiplier ChromaMultiplier
IsBackground bool
Background DynamicColorFn
SecondBackground DynamicColorFn
ToneDeltaPair ToneDeltaPairFn
ContrastCurve ContrastCurveFn
}
DynamicColor represents a color in a dynamic color scheme
func DynamicColorFromPalette ¶
func DynamicColorFromPalette(args *DynamicColor) *DynamicColor
func FromPalette ¶
func FromPalette(name string, palette TonalPaletteFn, tone ToneFn) *DynamicColor
FromPalette creates a DynamicColor from a palette and tone function
func (*DynamicColor) GetArgb ¶
func (dc *DynamicColor) GetArgb(scheme *DynamicScheme) color.ARGB
GetArgb returns the ARGB value for the DynamicColor in the given scheme
func (*DynamicColor) GetHct ¶
func (dc *DynamicColor) GetHct(scheme *DynamicScheme) color.Hct
GetHct returns the HCT color for the DynamicColor in the given scheme
func (*DynamicColor) GetTone ¶
func (dc *DynamicColor) GetTone(scheme *DynamicScheme) float64
type DynamicColorFn ¶
type DynamicColorFn func(s *DynamicScheme) *DynamicColor
Function type definitions
type DynamicScheme ¶
type DynamicScheme struct {
SourceColorHct color.Hct
Variant Variant
IsDark bool
Platform Platform
Version Version
ContrastLevel float64
PrimaryPalette palettes.TonalPalette
SecondaryPalette palettes.TonalPalette
TertiaryPalette palettes.TonalPalette
NeutralPalette palettes.TonalPalette
NeutralVariantPalette palettes.TonalPalette
ErrorPalette palettes.TonalPalette
MaterialColor MaterialColorSpec
}
func NewDynamicScheme ¶
func NewDynamicScheme( sourceColorHct color.Hct, variant Variant, contrastLevel float64, isDark bool, platform Platform, version Version, primaryPalette *palettes.TonalPalette, secondaryPalette *palettes.TonalPalette, tertiaryPalette *palettes.TonalPalette, neutralPalette *palettes.TonalPalette, neutralVariantPalette *palettes.TonalPalette, errorPalette *palettes.TonalPalette, ) *DynamicScheme
func (DynamicScheme) SourceColorArgb ¶
func (d DynamicScheme) SourceColorArgb() color.ARGB
func (DynamicScheme) ToColorMap ¶
func (d DynamicScheme) ToColorMap() map[string]*DynamicColor
type DynamicSchemePalettesDelegate ¶
type DynamicSchemePalettesDelegate interface {
GetPrimaryPalette(variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, contrastLevel float64) *palettes.TonalPalette
GetSecondaryPalette(variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, contrastLevel float64) *palettes.TonalPalette
GetTertiaryPalette(variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, contrastLevel float64) *palettes.TonalPalette
GetNeutralPalette(variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, contrastLevel float64) *palettes.TonalPalette
GetNeutralVariantPalette(variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, contrastLevel float64) *palettes.TonalPalette
GetErrorPalette(variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, contrastLevel float64) *palettes.TonalPalette
}
DynamicSchemePalettesDelegate is an interface for the palettes of a DynamicScheme
type DynamicSchemePalettesDelegateImpl2021 ¶
type DynamicSchemePalettesDelegateImpl2021 struct{}
DynamicSchemePalettesDelegateImpl2021 implements the palettes delegate for the 2021 spec
func (*DynamicSchemePalettesDelegateImpl2021) GetErrorPalette ¶
func (d *DynamicSchemePalettesDelegateImpl2021) GetErrorPalette( variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, contrastLevel float64, ) *palettes.TonalPalette
GetErrorPalette returns the error palette for a given variant and color
func (*DynamicSchemePalettesDelegateImpl2021) GetNeutralPalette ¶
func (d *DynamicSchemePalettesDelegateImpl2021) GetNeutralPalette( variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, contrastLevel float64, ) *palettes.TonalPalette
GetNeutralPalette returns the neutral palette for a given variant and color
func (*DynamicSchemePalettesDelegateImpl2021) GetNeutralVariantPalette ¶
func (d *DynamicSchemePalettesDelegateImpl2021) GetNeutralVariantPalette( variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, contrastLevel float64, ) *palettes.TonalPalette
GetNeutralVariantPalette returns the neutral variant palette for a given variant and color
func (*DynamicSchemePalettesDelegateImpl2021) GetPrimaryPalette ¶
func (d *DynamicSchemePalettesDelegateImpl2021) GetPrimaryPalette( variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, contrastLevel float64, ) *palettes.TonalPalette
GetPrimaryPalette returns the primary palette for a given variant and color
func (*DynamicSchemePalettesDelegateImpl2021) GetSecondaryPalette ¶
func (d *DynamicSchemePalettesDelegateImpl2021) GetSecondaryPalette( variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, contrastLevel float64, ) *palettes.TonalPalette
GetSecondaryPalette returns the secondary palette for a given variant and color
func (*DynamicSchemePalettesDelegateImpl2021) GetTertiaryPalette ¶
func (d *DynamicSchemePalettesDelegateImpl2021) GetTertiaryPalette( variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, contrastLevel float64, ) *palettes.TonalPalette
GetTertiaryPalette returns the tertiary palette for a given variant and color
type DynamicSchemePalettesDelegateImpl2025 ¶
type DynamicSchemePalettesDelegateImpl2025 struct {
DynamicSchemePalettesDelegateImpl2021
}
DynamicSchemePalettesDelegateImpl2025 extends the 2021 implementation for the 2025 spec
func (*DynamicSchemePalettesDelegateImpl2025) GetErrorPalette ¶
func (d *DynamicSchemePalettesDelegateImpl2025) GetErrorPalette( variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, contrastLevel float64, ) *palettes.TonalPalette
GetErrorPalette overrides the 2021 implementation for the 2025 spec
func (*DynamicSchemePalettesDelegateImpl2025) GetNeutralPalette ¶
func (d *DynamicSchemePalettesDelegateImpl2025) GetNeutralPalette( variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, contrastLevel float64, ) *palettes.TonalPalette
GetNeutralPalette overrides the 2021 implementation for the 2025 spec
func (*DynamicSchemePalettesDelegateImpl2025) GetNeutralVariantPalette ¶
func (d *DynamicSchemePalettesDelegateImpl2025) GetNeutralVariantPalette( variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, contrastLevel float64, ) *palettes.TonalPalette
GetNeutralVariantPalette overrides the 2021 implementation for the 2025 spec
func (*DynamicSchemePalettesDelegateImpl2025) GetPrimaryPalette ¶
func (d *DynamicSchemePalettesDelegateImpl2025) GetPrimaryPalette( variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, contrastLevel float64, ) *palettes.TonalPalette
GetPrimaryPalette overrides the 2021 implementation for the 2025 spec
func (*DynamicSchemePalettesDelegateImpl2025) GetSecondaryPalette ¶
func (d *DynamicSchemePalettesDelegateImpl2025) GetSecondaryPalette( variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, contrastLevel float64, ) *palettes.TonalPalette
GetSecondaryPalette overrides the 2021 implementation for the 2025 spec
func (*DynamicSchemePalettesDelegateImpl2025) GetTertiaryPalette ¶
func (d *DynamicSchemePalettesDelegateImpl2025) GetTertiaryPalette( variant Variant, sourceColorHct color.Hct, isDark bool, platform Platform, contrastLevel float64, ) *palettes.TonalPalette
GetTertiaryPalette overrides the 2021 implementation for the 2025 spec
type MaterialColorSpec ¶
type MaterialColorSpec interface {
Background() *DynamicColor
Error() *DynamicColor
ErrorContainer() *DynamicColor
ErrorDim() *DynamicColor
HighestSurface(s *DynamicScheme) *DynamicColor
InverseOnSurface() *DynamicColor
InversePrimary() *DynamicColor
InverseSurface() *DynamicColor
NeutralPaletteKeyColor() *DynamicColor
NeutralVariantPaletteKeyColor() *DynamicColor
OnBackground() *DynamicColor
OnError() *DynamicColor
OnErrorContainer() *DynamicColor
OnPrimary() *DynamicColor
OnPrimaryContainer() *DynamicColor
OnPrimaryFixed() *DynamicColor
OnPrimaryFixedVariant() *DynamicColor
OnSecondary() *DynamicColor
OnSecondaryContainer() *DynamicColor
OnSecondaryFixed() *DynamicColor
OnSecondaryFixedVariant() *DynamicColor
OnSurface() *DynamicColor
OnSurfaceVariant() *DynamicColor
OnTertiary() *DynamicColor
OnTertiaryContainer() *DynamicColor
OnTertiaryFixed() *DynamicColor
OnTertiaryFixedVariant() *DynamicColor
Outline() *DynamicColor
OutlineVariant() *DynamicColor
Primary() *DynamicColor
PrimaryContainer() *DynamicColor
PrimaryDim() *DynamicColor
PrimaryFixed() *DynamicColor
PrimaryFixedDim() *DynamicColor
PrimaryPaletteKeyColor() *DynamicColor
Scrim() *DynamicColor
Secondary() *DynamicColor
SecondaryContainer() *DynamicColor
SecondaryDim() *DynamicColor
SecondaryFixed() *DynamicColor
SecondaryFixedDim() *DynamicColor
SecondaryPaletteKeyColor() *DynamicColor
Shadow() *DynamicColor
Surface() *DynamicColor
SurfaceBright() *DynamicColor
SurfaceContainer() *DynamicColor
SurfaceContainerHigh() *DynamicColor
SurfaceContainerHighest() *DynamicColor
SurfaceContainerLow() *DynamicColor
SurfaceContainerLowest() *DynamicColor
SurfaceDim() *DynamicColor
SurfaceTint() *DynamicColor
SurfaceVariant() *DynamicColor
Tertiary() *DynamicColor
TertiaryContainer() *DynamicColor
TertiaryDim() *DynamicColor
TertiaryFixed() *DynamicColor
TertiaryFixedDim() *DynamicColor
TertiaryPaletteKeyColor() *DynamicColor
}
type MaterialSpec2021 ¶
type MaterialSpec2021 struct{}
func (MaterialSpec2021) Background ¶
func (m MaterialSpec2021) Background() *DynamicColor
func (MaterialSpec2021) Error ¶
func (m MaterialSpec2021) Error() *DynamicColor
func (MaterialSpec2021) ErrorContainer ¶
func (m MaterialSpec2021) ErrorContainer() *DynamicColor
func (MaterialSpec2021) ErrorDim ¶
func (m MaterialSpec2021) ErrorDim() *DynamicColor
func (MaterialSpec2021) HighestSurface ¶
func (m MaterialSpec2021) HighestSurface(s *DynamicScheme) *DynamicColor
HighestSurface returns the highest surface color based on dark mode
func (MaterialSpec2021) InverseOnSurface ¶
func (m MaterialSpec2021) InverseOnSurface() *DynamicColor
func (MaterialSpec2021) InversePrimary ¶
func (m MaterialSpec2021) InversePrimary() *DynamicColor
func (MaterialSpec2021) InverseSurface ¶
func (m MaterialSpec2021) InverseSurface() *DynamicColor
func (MaterialSpec2021) NeutralPaletteKeyColor ¶
func (m MaterialSpec2021) NeutralPaletteKeyColor() *DynamicColor
func (MaterialSpec2021) NeutralVariantPaletteKeyColor ¶
func (m MaterialSpec2021) NeutralVariantPaletteKeyColor() *DynamicColor
func (MaterialSpec2021) OnBackground ¶
func (m MaterialSpec2021) OnBackground() *DynamicColor
func (MaterialSpec2021) OnError ¶
func (m MaterialSpec2021) OnError() *DynamicColor
func (MaterialSpec2021) OnErrorContainer ¶
func (m MaterialSpec2021) OnErrorContainer() *DynamicColor
func (MaterialSpec2021) OnPrimary ¶
func (m MaterialSpec2021) OnPrimary() *DynamicColor
func (MaterialSpec2021) OnPrimaryContainer ¶
func (m MaterialSpec2021) OnPrimaryContainer() *DynamicColor
func (MaterialSpec2021) OnPrimaryFixed ¶
func (m MaterialSpec2021) OnPrimaryFixed() *DynamicColor
func (MaterialSpec2021) OnPrimaryFixedVariant ¶
func (m MaterialSpec2021) OnPrimaryFixedVariant() *DynamicColor
func (MaterialSpec2021) OnSecondary ¶
func (m MaterialSpec2021) OnSecondary() *DynamicColor
func (MaterialSpec2021) OnSecondaryContainer ¶
func (m MaterialSpec2021) OnSecondaryContainer() *DynamicColor
func (MaterialSpec2021) OnSecondaryFixed ¶
func (m MaterialSpec2021) OnSecondaryFixed() *DynamicColor
func (MaterialSpec2021) OnSecondaryFixedVariant ¶
func (m MaterialSpec2021) OnSecondaryFixedVariant() *DynamicColor
func (MaterialSpec2021) OnSurface ¶
func (m MaterialSpec2021) OnSurface() *DynamicColor
func (MaterialSpec2021) OnSurfaceVariant ¶
func (m MaterialSpec2021) OnSurfaceVariant() *DynamicColor
func (MaterialSpec2021) OnTertiary ¶
func (m MaterialSpec2021) OnTertiary() *DynamicColor
func (MaterialSpec2021) OnTertiaryContainer ¶
func (m MaterialSpec2021) OnTertiaryContainer() *DynamicColor
func (MaterialSpec2021) OnTertiaryFixed ¶
func (m MaterialSpec2021) OnTertiaryFixed() *DynamicColor
func (MaterialSpec2021) OnTertiaryFixedVariant ¶
func (m MaterialSpec2021) OnTertiaryFixedVariant() *DynamicColor
func (MaterialSpec2021) Outline ¶
func (m MaterialSpec2021) Outline() *DynamicColor
func (MaterialSpec2021) OutlineVariant ¶
func (m MaterialSpec2021) OutlineVariant() *DynamicColor
func (MaterialSpec2021) Primary ¶
func (m MaterialSpec2021) Primary() *DynamicColor
func (MaterialSpec2021) PrimaryContainer ¶
func (m MaterialSpec2021) PrimaryContainer() *DynamicColor
func (MaterialSpec2021) PrimaryDim ¶
func (m MaterialSpec2021) PrimaryDim() *DynamicColor
func (MaterialSpec2021) PrimaryFixed ¶
func (m MaterialSpec2021) PrimaryFixed() *DynamicColor
func (MaterialSpec2021) PrimaryFixedDim ¶
func (m MaterialSpec2021) PrimaryFixedDim() *DynamicColor
func (MaterialSpec2021) PrimaryPaletteKeyColor ¶
func (m MaterialSpec2021) PrimaryPaletteKeyColor() *DynamicColor
func (MaterialSpec2021) Scrim ¶
func (m MaterialSpec2021) Scrim() *DynamicColor
func (MaterialSpec2021) Secondary ¶
func (m MaterialSpec2021) Secondary() *DynamicColor
func (MaterialSpec2021) SecondaryContainer ¶
func (m MaterialSpec2021) SecondaryContainer() *DynamicColor
func (MaterialSpec2021) SecondaryDim ¶
func (m MaterialSpec2021) SecondaryDim() *DynamicColor
func (MaterialSpec2021) SecondaryFixed ¶
func (m MaterialSpec2021) SecondaryFixed() *DynamicColor
func (MaterialSpec2021) SecondaryFixedDim ¶
func (m MaterialSpec2021) SecondaryFixedDim() *DynamicColor
func (MaterialSpec2021) SecondaryPaletteKeyColor ¶
func (m MaterialSpec2021) SecondaryPaletteKeyColor() *DynamicColor
func (MaterialSpec2021) Shadow ¶
func (m MaterialSpec2021) Shadow() *DynamicColor
func (MaterialSpec2021) Surface ¶
func (m MaterialSpec2021) Surface() *DynamicColor
func (MaterialSpec2021) SurfaceBright ¶
func (m MaterialSpec2021) SurfaceBright() *DynamicColor
func (MaterialSpec2021) SurfaceContainer ¶
func (m MaterialSpec2021) SurfaceContainer() *DynamicColor
func (MaterialSpec2021) SurfaceContainerHigh ¶
func (m MaterialSpec2021) SurfaceContainerHigh() *DynamicColor
func (MaterialSpec2021) SurfaceContainerHighest ¶
func (m MaterialSpec2021) SurfaceContainerHighest() *DynamicColor
func (MaterialSpec2021) SurfaceContainerLow ¶
func (m MaterialSpec2021) SurfaceContainerLow() *DynamicColor
func (MaterialSpec2021) SurfaceContainerLowest ¶
func (m MaterialSpec2021) SurfaceContainerLowest() *DynamicColor
func (MaterialSpec2021) SurfaceDim ¶
func (m MaterialSpec2021) SurfaceDim() *DynamicColor
func (MaterialSpec2021) SurfaceTint ¶
func (m MaterialSpec2021) SurfaceTint() *DynamicColor
func (MaterialSpec2021) SurfaceVariant ¶
func (m MaterialSpec2021) SurfaceVariant() *DynamicColor
func (MaterialSpec2021) Tertiary ¶
func (m MaterialSpec2021) Tertiary() *DynamicColor
func (MaterialSpec2021) TertiaryContainer ¶
func (m MaterialSpec2021) TertiaryContainer() *DynamicColor
func (MaterialSpec2021) TertiaryDim ¶
func (m MaterialSpec2021) TertiaryDim() *DynamicColor
func (MaterialSpec2021) TertiaryFixed ¶
func (m MaterialSpec2021) TertiaryFixed() *DynamicColor
func (MaterialSpec2021) TertiaryFixedDim ¶
func (m MaterialSpec2021) TertiaryFixedDim() *DynamicColor
func (MaterialSpec2021) TertiaryPaletteKeyColor ¶
func (m MaterialSpec2021) TertiaryPaletteKeyColor() *DynamicColor
type MaterialSpec2025 ¶
type MaterialSpec2025 struct {
MaterialSpec2021
}
func (MaterialSpec2025) Error ¶
func (m MaterialSpec2025) Error() *DynamicColor
func (MaterialSpec2025) ErrorContainer ¶
func (m MaterialSpec2025) ErrorContainer() *DynamicColor
func (MaterialSpec2025) ErrorDim ¶
func (m MaterialSpec2025) ErrorDim() *DynamicColor
func (MaterialSpec2025) InverseOnSurface ¶
func (m MaterialSpec2025) InverseOnSurface() *DynamicColor
func (MaterialSpec2025) InversePrimary ¶
func (m MaterialSpec2025) InversePrimary() *DynamicColor
func (MaterialSpec2025) InverseSurface ¶
func (m MaterialSpec2025) InverseSurface() *DynamicColor
func (MaterialSpec2025) OnError ¶
func (m MaterialSpec2025) OnError() *DynamicColor
func (MaterialSpec2025) OnErrorContainer ¶
func (m MaterialSpec2025) OnErrorContainer() *DynamicColor
func (MaterialSpec2025) OnPrimary ¶
func (m MaterialSpec2025) OnPrimary() *DynamicColor
func (MaterialSpec2025) OnPrimaryContainer ¶
func (m MaterialSpec2025) OnPrimaryContainer() *DynamicColor
func (MaterialSpec2025) OnPrimaryFixed ¶
func (m MaterialSpec2025) OnPrimaryFixed() *DynamicColor
func (MaterialSpec2025) OnPrimaryFixedVariant ¶
func (m MaterialSpec2025) OnPrimaryFixedVariant() *DynamicColor
func (MaterialSpec2025) OnSecondary ¶
func (m MaterialSpec2025) OnSecondary() *DynamicColor
func (MaterialSpec2025) OnSecondaryContainer ¶
func (m MaterialSpec2025) OnSecondaryContainer() *DynamicColor
func (MaterialSpec2025) OnSecondaryFixed ¶
func (m MaterialSpec2025) OnSecondaryFixed() *DynamicColor
func (MaterialSpec2025) OnSecondaryFixedVariant ¶
func (m MaterialSpec2025) OnSecondaryFixedVariant() *DynamicColor
func (MaterialSpec2025) OnSurface ¶
func (m MaterialSpec2025) OnSurface() *DynamicColor
func (MaterialSpec2025) OnSurfaceVariant ¶
func (m MaterialSpec2025) OnSurfaceVariant() *DynamicColor
func (MaterialSpec2025) OnTertiary ¶
func (m MaterialSpec2025) OnTertiary() *DynamicColor
func (MaterialSpec2025) OnTertiaryContainer ¶
func (m MaterialSpec2025) OnTertiaryContainer() *DynamicColor
func (MaterialSpec2025) OnTertiaryFixed ¶
func (m MaterialSpec2025) OnTertiaryFixed() *DynamicColor
func (MaterialSpec2025) OnTertiaryFixedVariant ¶
func (m MaterialSpec2025) OnTertiaryFixedVariant() *DynamicColor
func (MaterialSpec2025) Outline ¶
func (m MaterialSpec2025) Outline() *DynamicColor
func (MaterialSpec2025) OutlineVariant ¶
func (m MaterialSpec2025) OutlineVariant() *DynamicColor
func (MaterialSpec2025) Primary ¶
func (m MaterialSpec2025) Primary() *DynamicColor
func (MaterialSpec2025) PrimaryContainer ¶
func (m MaterialSpec2025) PrimaryContainer() *DynamicColor
func (MaterialSpec2025) PrimaryDim ¶
func (m MaterialSpec2025) PrimaryDim() *DynamicColor
func (MaterialSpec2025) PrimaryFixed ¶
func (m MaterialSpec2025) PrimaryFixed() *DynamicColor
func (MaterialSpec2025) PrimaryFixedDim ¶
func (m MaterialSpec2025) PrimaryFixedDim() *DynamicColor
func (MaterialSpec2025) Secondary ¶
func (m MaterialSpec2025) Secondary() *DynamicColor
func (MaterialSpec2025) SecondaryContainer ¶
func (m MaterialSpec2025) SecondaryContainer() *DynamicColor
func (MaterialSpec2025) SecondaryDim ¶
func (m MaterialSpec2025) SecondaryDim() *DynamicColor
func (MaterialSpec2025) SecondaryFixed ¶
func (m MaterialSpec2025) SecondaryFixed() *DynamicColor
func (MaterialSpec2025) SecondaryFixedDim ¶
func (m MaterialSpec2025) SecondaryFixedDim() *DynamicColor
func (MaterialSpec2025) Surface ¶
func (m MaterialSpec2025) Surface() *DynamicColor
func (MaterialSpec2025) SurfaceBright ¶
func (m MaterialSpec2025) SurfaceBright() *DynamicColor
func (MaterialSpec2025) SurfaceContainer ¶
func (m MaterialSpec2025) SurfaceContainer() *DynamicColor
func (MaterialSpec2025) SurfaceContainerHigh ¶
func (m MaterialSpec2025) SurfaceContainerHigh() *DynamicColor
func (MaterialSpec2025) SurfaceContainerHighest ¶
func (m MaterialSpec2025) SurfaceContainerHighest() *DynamicColor
func (MaterialSpec2025) SurfaceContainerLow ¶
func (m MaterialSpec2025) SurfaceContainerLow() *DynamicColor
func (MaterialSpec2025) SurfaceContainerLowest ¶
func (m MaterialSpec2025) SurfaceContainerLowest() *DynamicColor
func (MaterialSpec2025) SurfaceDim ¶
func (m MaterialSpec2025) SurfaceDim() *DynamicColor
func (MaterialSpec2025) Tertiary ¶
func (m MaterialSpec2025) Tertiary() *DynamicColor
func (MaterialSpec2025) TertiaryContainer ¶
func (m MaterialSpec2025) TertiaryContainer() *DynamicColor
func (MaterialSpec2025) TertiaryDim ¶
func (m MaterialSpec2025) TertiaryDim() *DynamicColor
func (MaterialSpec2025) TertiaryFixed ¶
func (m MaterialSpec2025) TertiaryFixed() *DynamicColor
func (MaterialSpec2025) TertiaryFixedDim ¶
func (m MaterialSpec2025) TertiaryFixedDim() *DynamicColor
type Platform ¶
type Platform uint
Platform indicates target platform for generating colors
ENUM(phone, watch)
func ParsePlatform ¶
ParsePlatform attempts to convert a string to a Platform.
func (*Platform) AppendText ¶
AppendText appends the textual representation of itself to the end of b (allocating a larger slice if necessary) and returns the updated slice.
Implementations must not retain b, nor mutate any bytes within b[:len(b)].
func (Platform) IsValid ¶
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (Platform) MarshalText ¶
MarshalText implements the text marshaller method.
func (*Platform) UnmarshalText ¶
UnmarshalText implements the text unmarshaller method.
type TonalPaletteFn ¶
type TonalPaletteFn func(s *DynamicScheme) palettes.TonalPalette
Function type definitions
type ToneDeltaPair ¶
type ToneDeltaPair struct {
RoleA, RoleB *DynamicColor
Delta float64
Polarity TonePolarity
StayTogether bool
Constraint DeltaConstraint
}
ToneDeltaPair documents a constraint between two DynamicColors, in which their tones must have a certain distance from each other.
func NewToneDeltaPair ¶
func NewToneDeltaPair( roleA, roleB *DynamicColor, delta float64, polarity TonePolarity, stayTogether bool, constraint ...DeltaConstraint, ) *ToneDeltaPair
NewToneDeltaPair creates a new ToneDeltaPair with default constraint = "exact".
type ToneDeltaPairFn ¶
type ToneDeltaPairFn func(s *DynamicScheme) *ToneDeltaPair
Function type definitions
type ToneFn ¶
type ToneFn func(s *DynamicScheme) float64
Function type definitions
func GetInitialToneFromBackground ¶
func GetInitialToneFromBackground(background DynamicColorFn) ToneFn
type TonePolarity ¶
type TonePolarity uint
TonePolarity describes the difference in tone between colors.
ENUM(tone_darker, tone_lighter, tone_nearer, tone_farther, tone_relative_darker, tone_relative_lighter)
const ( // ToneDarker is a TonePolarity of type Tone_darker. ToneDarker TonePolarity = iota // ToneLighter is a TonePolarity of type Tone_lighter. ToneLighter // ToneNearer is a TonePolarity of type Tone_nearer. ToneNearer // ToneFarther is a TonePolarity of type Tone_farther. ToneFarther // ToneRelativeDarker is a TonePolarity of type Tone_relative_darker. ToneRelativeDarker // ToneRelativeLighter is a TonePolarity of type Tone_relative_lighter. ToneRelativeLighter )
func ParseTonePolarity ¶
func ParseTonePolarity(name string) (TonePolarity, error)
ParseTonePolarity attempts to convert a string to a TonePolarity.
func (*TonePolarity) AppendText ¶
func (x *TonePolarity) AppendText(b []byte) ([]byte, error)
AppendText appends the textual representation of itself to the end of b (allocating a larger slice if necessary) and returns the updated slice.
Implementations must not retain b, nor mutate any bytes within b[:len(b)].
func (TonePolarity) IsValid ¶
func (x TonePolarity) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (TonePolarity) MarshalText ¶
func (x TonePolarity) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (TonePolarity) String ¶
func (x TonePolarity) String() string
String implements the Stringer interface.
func (*TonePolarity) UnmarshalText ¶
func (x *TonePolarity) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type Variant ¶
type Variant uint
Variant indicates type of scheme to generate
ENUM(monochrome, neutral, tonal_spot, vibrant, expressive, fidelity, content, rainbow, fruit_salad)
const ( // Monochrome is a Variant of type Monochrome. Monochrome Variant = iota // Neutral is a Variant of type Neutral. Neutral // TonalSpot is a Variant of type Tonal_spot. TonalSpot // Vibrant is a Variant of type Vibrant. Vibrant // Expressive is a Variant of type Expressive. Expressive // Fidelity is a Variant of type Fidelity. Fidelity // Content is a Variant of type Content. Content // Rainbow is a Variant of type Rainbow. Rainbow // FruitSalad is a Variant of type Fruit_salad. FruitSalad )
func ParseVariant ¶
ParseVariant attempts to convert a string to a Variant.
func (*Variant) AppendText ¶
AppendText appends the textual representation of itself to the end of b (allocating a larger slice if necessary) and returns the updated slice.
Implementations must not retain b, nor mutate any bytes within b[:len(b)].
func (Variant) IsValid ¶
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (Variant) MarshalText ¶
MarshalText implements the text marshaller method.
func (*Variant) UnmarshalText ¶
UnmarshalText implements the text unmarshaller method.
type Version ¶
type Version uint
Version indicates the material color specification year
ENUM(2021=2021, 2025=2025)
func ParseVersion ¶
ParseVersion attempts to convert a string to a Version.
func (*Version) AppendText ¶
AppendText appends the textual representation of itself to the end of b (allocating a larger slice if necessary) and returns the updated slice.
Implementations must not retain b, nor mutate any bytes within b[:len(b)].
func (Version) IsValid ¶
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (Version) MarshalText ¶
MarshalText implements the text marshaller method.
func (*Version) UnmarshalText ¶
UnmarshalText implements the text unmarshaller method.