dynamic

package
v0.0.7-alpha Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2025 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ColorCalculation2021 = colorCalculationDelegateImpl2021{}
View Source
var ColorCalculation2025 = colorCalculationDelegateImpl2025{}

Functions

func EnableLightForeground

func EnableLightForeground(tone float64) float64

EnableLightForeground adjusts a tone to enable light foreground if needed

func FindDesiredChromaByTone

func FindDesiredChromaByTone(hue, chroma, tone float64, byDecreasingTone bool) float64

FindDesiredChromaByTone finds a tone where the chroma is as close as possible to the requested value

func ForegroundTone

func ForegroundTone(bgTone, ratio float64) float64

ForegroundTone calculates a foreground tone that has sufficient contrast with a background tone

func GetPiecewiseHue

func GetPiecewiseHue(sourceColorHct color.Hct, hueBreakpoints []float64, hues []float64) float64

GetPiecewiseHue returns a new hue based on a piece wise function and the input color's hue.

func GetRotatedHue

func GetRotatedHue(sourceColorHct color.Hct, hueBreakpoints []float64, rotations []float64) float64

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

func ToneAllowsLightForeground(tone float64) bool

ToneAllowsLightForeground determines if a tone allows light foreground

func TonePrefersLightForeground

func TonePrefersLightForeground(tone float64) bool

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 string

DeltaConstraint describes how to fulfill a tone delta pair constraint.

const (
	ConstraintExact   DeltaConstraint = "exact"
	ConstraintNearer  DeltaConstraint = "nearer"
	ConstraintFarther DeltaConstraint = "farther"
)

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 ExtendSpecVersion

func ExtendSpecVersion(
	originalColor *DynamicColor,
	specVersion Version,
	extendedColor *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 DynamicSchemeFn

type DynamicSchemeFn func(s *DynamicScheme) any

Function type definitions

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 string
const (
	Phone Platform = "phone"
	Watch Platform = "watch"
)

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 string

TonePolarity describes the difference in tone between colors.

const (
	ToneDarker          TonePolarity = "darker"
	ToneLighter         TonePolarity = "lighter"
	ToneNearer          TonePolarity = "nearer"  // deprecated
	ToneFarther         TonePolarity = "farther" // deprecated
	ToneRelativeDarker  TonePolarity = "relative_darker"
	ToneRelativeLighter TonePolarity = "relative_lighter"
)

type Variant

type Variant string
const (
	Monochrome Variant = "monochrome"
	Neutral    Variant = "neutral"
	TonalSpot  Variant = "tonal_spot"
	Vibrant    Variant = "vibrant"
	Expressive Variant = "expressive"
	Fidelity   Variant = "fidelity"
	Content    Variant = "content"
	Rainbow    Variant = "rainbow"
	FruitSalad Variant = "fruit_salad"
)

type Version

type Version int
const (
	V2021 Version = 2021
	V2025 Version = 2025
)

Jump to

Keyboard shortcuts

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