ZetaColorSwatch class Theme

A swatch of colors with values from 10 (light) to 100 (dark).

See also:

Inheritance
Mixed-in types
Available extensions
Annotations

Constructors

ZetaColorSwatch({Brightness brightness = Brightness.light, ZetaContrast contrast = ZetaContrast.aa, required int primary, required Map<int, Color> swatch})
Constructs a ZetaColorSwatch.
const
ZetaColorSwatch.fromColor(Color primary, {Brightness brightness = Brightness.light, ZetaContrast contrast = ZetaContrast.aa, Color background = Colors.white})
ZetaColorSwatch is a color swatch utility to produce different shades of a primary color, following a specific progression of lightness and darkness.
factory

Properties

a double
The alpha channel of this color.
finalinherited
alpha int
The alpha channel of this color in an 8 bit value.
no setterinherited
b double
The blue channel of this color.
finalinherited
blue int
The blue channel of this color in an 8 bit value.
no setterinherited
border Color
Returns the color shade for a border depending on the ZetaContrast value.
no setter
brightness Brightness
Selected contrast level of the system
final
colorSpace ColorSpace
The color space of this color.
finalinherited
contrast ZetaContrast
Selected contrast level of the system
final
focus Color
Returns the color shade for a focus state depending on the ZetaContrast value.
no setter
g double
The green channel of this color.
finalinherited
green int
The green channel of this color in an 8 bit value.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
hexCode String

Available on Color, provided by the ZetaColorExtensions extension

Return uppercase Flutter style hex code string of the color.
no setter
hover Color
Returns the color shade for a hover state depending on the ZetaContrast value.
no setter
icon Color
Returns the color shade for an icon depending on the ZetaContrast value.
no setter
isDark bool

Available on Color, provided by the ZetaColorExtensions extension

Returns true if the color's brightness is Brightness.dark, else false.
no setter
isLight bool

Available on Color, provided by the ZetaColorExtensions extension

Returns true if the color's brightness is Brightness.light, else false.
no setter
keys Iterable<int>
Returns the valid keys for accessing operator[].
no setterinherited
lightness double

Available on Color, provided by the ZetaColorExtensions extension

Gets lightness of color.
no setter
onColor Color

Available on Color, provided by the ZetaColorExtensions extension

This getter returns appropriate contrast color based on a given color. It will return a color chosen according to the brightness of this color.
no setter
opacity double
The alpha channel of this color as a double.
no setterinherited
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setteroverride
r double
The red channel of this color.
finalinherited
red int
The red channel of this color in an 8 bit value.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selected Color
Returns the color shade for a selected state depending on the ZetaContrast value.
no setter
shade10 Color
The lightest shade.
no setter
shade100 Color
The darkest shade.
no setter
shade20 Color
The second lightest shade.
no setter
shade30 Color
The third lightest shade.
no setter
shade40 Color
The fourth lightest shade.
no setter
shade50 Color
The fifth lightest shade.
no setter
shade60 Color
The default shade.
no setter
shade70 Color
The fourth darkest shade.
no setter
shade80 Color
The third darkest shade.
no setter
shade90 Color
The second darkest shade.
no setter
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
subtle Color
Returns the color shade for a subtle visual element depending on the ZetaContrast value.
no setter
surface Color
Returns the color shade for a surface depending on the ZetaContrast value.
no setter
text Color
Returns the color shade for a surface depending on the ZetaContrast value.
no setter
value int
A 32 bit value representing this color.
no setterinherited
zetaColorSwatch ZetaColorSwatch

Available on Color, provided by the ZetaColorExtensions extension

ZetaColorSwatch is a color swatch utility to produce different shades of a primary color, following a specific progression of lightness and darkness.
no setter

Methods

adjustContrast({required Color on, required double target, int maxIterations = 1000, double epsilon = 0.1}) Color

Available on Color, provided by the ZetaColorExtensions extension

Adjusts the color to a specific contrast target.
apply({ZetaContrast contrast = ZetaContrast.aa, Brightness brightness = Brightness.light}) ZetaColorSwatch
Creates a copy of the current ZetaColorSwatch with potential modifications based on the provided contrast and brightness.
blend(Color input, [int amount = 10]) Color

Available on Color, provided by the ZetaColorExtensions extension

Blend in the given input Color with a percentage of alpha.
blendAlpha(Color input, [int alpha = 0x0A]) Color

Available on Color, provided by the ZetaColorExtensions extension

Blend in the given input Color with an alpha value.
brighten([int amount = 10]) Color

Available on Color, provided by the ZetaColorExtensions extension

Brightens the color with the given integer percentage amount. Defaults to 10%.
computeLuminance() double
Returns a brightness value between 0 for darkest and 1 for lightest.
inherited
contrastRatio(Color b) double

Available on Color, provided by the ZetaColorExtensions extension

Calculates the contrast ratio between the current color and the given color b.
darken([int amount = 10]) Color

Available on Color, provided by the ZetaColorExtensions extension

Darkens the color with the given integer percentage amount. Defaults to 10%.
ensureAccessibility({required Color on, ZetaContrast standard = ZetaContrast.aa}) Color

Available on Color, provided by the ZetaColorExtensions extension

Adjusts the current color to meet the specified accessibility standard standard when set against the on color.
generateSwatch({int primary = kZetaSwatchPrimaryIndex, Map<int, double> targetContrasts = kZetaSwatchTargetContrasts, Color background = ZetaColorBase.white, bool adjustPrimary = true}) Map<int, Color>

Available on Color, provided by the ZetaColorExtensions extension

Generates a color swatch for this color. A color swatch is a map with integer keys indexing to Color objects, typically used for design themes.
getShadeColor({int shadeValue = 15, bool lighten = true, bool keepBlack = true, bool keepWhite = true}) Color

Available on Color, provided by the ZetaColorExtensions extension

The getShadeColor extension is used to make a color darker or lighter, the shadeValue defines the amount in % that the shade should be changed.
lighten([int amount = 10]) Color

Available on Color, provided by the ZetaColorExtensions extension

Lightens the color with the given integer percentage amount. Defaults to 10%.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
shade(int number) Color
Takes an integer as argument and returns a color shade based on that number. If no shade with the given number exists, it returns the color itself.
toString() String
A string representation of this object.
inherited
withAlpha(int a) Color
Returns a new color that matches this color with the alpha channel replaced with a (which ranges from 0 to 255).
inherited
withBlue(int b) Color
Returns a new color that matches this color with the blue channel replaced with b (which ranges from 0 to 255).
inherited
withGreen(int g) Color
Returns a new color that matches this color with the green channel replaced with g (which ranges from 0 to 255).
inherited
withLightness(double percentage) Color

Available on Color, provided by the ZetaColorExtensions extension

Applies lightness percentage to color.
withOpacity(double opacity) Color
Returns a new color that matches this color with the alpha channel replaced with the given opacity (which ranges from 0.0 to 1.0).
inherited
withRed(int r) Color
Returns a new color that matches this color with the red channel replaced with r (which ranges from 0 to 255).
inherited
withValues({double? alpha, double? red, double? green, double? blue, ColorSpace? colorSpace}) Color
Returns a new color that matches this color with the passed in components changed.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](int index) Color?
This method is an override of the index operator.
override