Documentation ¶
Overview ¶
Package matcolor provides support for creating Material Design 3 color schemes and palettes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var SchemeIsDark = false
SchemeIsDark is whether the currently active color scheme is a dark-themed or light-themed color scheme. In almost all cases, it should be set via cogentcore.org/core/colors.SetScheme, not directly.
Functions ¶
This section is empty.
Types ¶
type Accent ¶
type Accent struct { // Base is the base color Base color.RGBA // On is the color applied to content on top of On color.RGBA // Container is the color applied to elements with less emphasis than Container color.RGBA // OnContainer is the color applied to content on top of OnContainer color.RGBA }
Accent contains the four standard variations of a base accent color.
func NewAccentDark ¶
NewAccentDark returns a new dark theme Accent from the given Tones
type Key ¶
type Key struct { // the primary accent key color Primary color.RGBA // the secondary accent key color Secondary color.RGBA // the tertiary accent key color Tertiary color.RGBA // the select accent key color Select color.RGBA // the error accent key color Error color.RGBA // the success accent key color Success color.RGBA // the warn accent key color Warn color.RGBA // the neutral key color used to generate surface and surface container colors Neutral color.RGBA // the neutral variant key color used to generate surface variant and outline colors NeutralVariant color.RGBA // an optional map of custom accent key colors Custom map[string]color.RGBA }
Key contains the set of key colors used to generate a Scheme and Palette
type Palette ¶
type Palette struct { // the tones for the primary key color Primary Tones // the tones for the secondary key color Secondary Tones // the tones for the tertiary key color Tertiary Tones // the tones for the select key color Select Tones // the tones for the error key color Error Tones // the tones for the success key color Success Tones // the tones for the warn key color Warn Tones // the tones for the neutral key color Neutral Tones // the tones for the neutral variant key color NeutralVariant Tones // an optional map of tones for custom accent key colors Custom map[string]Tones }
Palette contains a tonal palette with tonal values for each of the standard colors and any custom colors. Use NewPalette to create a new palette.
func NewPalette ¶
NewPalette creates a new Palette from the given key colors.
type Scheme ¶
type Scheme struct { // Primary is the primary color applied to important elements Primary Accent // Secondary is the secondary color applied to less important elements Secondary Accent // Tertiary is the tertiary color applied as an accent to highlight elements and create contrast between other colors Tertiary Accent // Select is the selection color applied to selected or highlighted elements and text Select Accent // Error is the error color applied to elements that indicate an error or danger Error Accent // Success is the color applied to elements that indicate success Success Accent // Warn is the color applied to elements that indicate a warning Warn Accent // an optional map of custom accent colors Custom map[string]Accent // SurfaceDim is the color applied to elements that will always have the dimmest surface color (see Surface for more information) SurfaceDim color.RGBA // Surface is the color applied to contained areas, like the background of an app Surface color.RGBA // SurfaceBright is the color applied to elements that will always have the brightest surface color (see Surface for more information) SurfaceBright color.RGBA // SurfaceContainerLowest is the color applied to surface container elements that have the lowest emphasis (see SurfaceContainer for more information) SurfaceContainerLowest color.RGBA // SurfaceContainerLow is the color applied to surface container elements that have lower emphasis (see SurfaceContainer for more information) SurfaceContainerLow color.RGBA // SurfaceContainer is the color applied to container elements that contrast elements with the surface color SurfaceContainer color.RGBA // SurfaceContainerHigh is the color applied to surface container elements that have higher emphasis (see SurfaceContainer for more information) SurfaceContainerHigh color.RGBA // SurfaceContainerHighest is the color applied to surface container elements that have the highest emphasis (see SurfaceContainer for more information) SurfaceContainerHighest color.RGBA // SurfaceVariant is the color applied to contained areas that contrast standard Surface elements SurfaceVariant color.RGBA // OnSurface is the color applied to content on top of Surface elements OnSurface color.RGBA // OnSurfaceVariant is the color applied to content on top of SurfaceVariant elements OnSurfaceVariant color.RGBA // InverseSurface is the color applied to elements to make them the reverse color of the surrounding elements and create a contrasting effect InverseSurface color.RGBA // InverseOnSurface is the color applied to content on top of InverseSurface InverseOnSurface color.RGBA // InversePrimary is the color applied to interactive elements on top of InverseSurface InversePrimary color.RGBA // Background is the color applied to the background of the app and other low-emphasis areas Background color.RGBA // OnBackground is the color applied to content on top of Background OnBackground color.RGBA // Outline is the color applied to borders to create emphasized boundaries that need to have sufficient contrast Outline color.RGBA // OutlineVariant is the color applied to create decorative boundaries OutlineVariant color.RGBA // Shadow is the color applied to shadows Shadow color.RGBA // SurfaceTint is the color applied to tint surfaces SurfaceTint color.RGBA // Scrim is the color applied to scrims (semi-transparent overlays) Scrim color.RGBA }
Scheme contains the colors for one color scheme (ex: light or dark). To generate a scheme, use [NewScheme].
func NewDarkScheme ¶
NewDarkScheme returns a new dark-themed Scheme based on the given Palette.
type Tones ¶
type Tones struct { // the key color used to generate these tones Key color.RGBA // the cached map of tonal color values Tones map[int]color.RGBA }
Tones contains cached color values for each tone of a seed color. To get a tonal value, use Tones.Tone.