ZetaPureColorSwatch class
A swatch of colors with values 0 (light), 500 (medium) and 1000(dark).
- Inheritance
-
- Object
- Color
- ColorSwatch<
int> - ZetaPureColorSwatch
- Mixed-in types
- Available extensions
Constructors
-
ZetaPureColorSwatch({required int primary, required Map<
int, Color> swatch, Brightness brightness = Brightness.light}) -
Constructs a ZetaPureColorSwatch.
const
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
- brightness → Brightness
-
Selected contrast level of the system
final
- colorSpace → ColorSpace
-
The color space of this color.
finalinherited
- 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 - 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
- shade0 → Color
-
Lightest shade of the color.
no setter
- shade1000 → Color
-
Darkest shade of the color.
no setter
- shade500 → Color
-
Medium shade of the color.
no setter
- stringify → bool?
-
If set to
true
, the toString method will be overridden to output this instance's props.no setterinherited - 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}) → ZetaPureColorSwatch -
Creates a copy of the current ZetaColorSwatch with potential modifications
based on the provided
contrast
andbrightness
. -
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 colorb
. -
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 standardstandard
when set against theon
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, theshadeValue
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.
-
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 key) → Color? -
Returns an element of the swatch table.
inherited