ColorShades class
A collection of color shades from light to dark.
Implements both Color and ColorSwatch to provide a primary color and access to different shade values (50, 100, 200, ..., 950).
- Implemented types
- Available extensions
Constructors
- ColorShades.fromAccent(Color accent, {int base = 500, int hueShift = 0, int saturationStepDown = 0, int saturationStepUp = 0, int lightnessStepDown = 8, int lightnessStepUp = 9})
-
Creates color shades from an accent color.
factory
- ColorShades.fromAccentHSL(HSLColor accent, {int base = 500, int hueShift = 0, int saturationStepDown = 0, int saturationStepUp = 0, int lightnessStepDown = 8, int lightnessStepUp = 9})
-
Creates color shades from an accent HSL color.
factory
-
ColorShades.fromMap(Map<
int, Color> colors) -
Creates color shades from a map of shade values to colors.
factory
-
ColorShades.raw(Map<
int, Color> _colors) -
Creates color shades from a raw map.
const
-
ColorShades.sorted(List<
Color> colors) -
Creates color shades from a sorted list of colors.
factory
Properties
- a → double
-
The alpha channel of this color.
no setteroverride
- alpha → int
-
The alpha channel of this color in an 8 bit value.
no setteroverride
- b → double
-
The blue channel of this color.
no setteroverride
- blue → int
-
The blue channel of this color in an 8 bit value.
no setteroverride
- colorSpace → ColorSpace
-
The color space of this color.
no setteroverride
- g → double
-
The green channel of this color.
no setteroverride
- green → int
-
The green channel of this color in an 8 bit value.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setteroverride
- keys → Iterable
-
Returns the valid keys for accessing operator[].
no setteroverride
- opacity → double
-
The alpha channel of this color as a double.
no setteroverride
- r → double
-
The red channel of this color.
no setteroverride
- red → int
-
The red channel of this color in an 8 bit value.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shade100 → Color
-
Gets shade 100.
no setter
- shade200 → Color
-
Gets shade 200.
no setter
- shade300 → Color
-
Gets shade 300.
no setter
- shade400 → Color
-
Gets shade 400.
no setter
- shade50 → Color
-
Gets the lightest shade (50).
no setter
- shade500 → Color
-
Gets the medium/default shade (500).
no setter
- shade600 → Color
-
Gets shade 600.
no setter
- shade700 → Color
-
Gets shade 700.
no setter
- shade800 → Color
-
Gets shade 800.
no setter
- shade900 → Color
-
Gets shade 900.
no setter
- shade950 → Color
-
Gets the darkest shade (950).
no setter
- value → int
-
A 32 bit value representing this color.
no setteroverride
Methods
-
computeLuminance(
) → double -
Returns a brightness value between 0 for darkest and 1 for lightest.
override
-
get(
int key) → Color - Gets the color for a specific shade value.
-
getContrastColor(
[double luminanceContrast = 1]) → Color -
Available on Color, provided by the ColorExtension extension
Gets a contrasting color based on luminance. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
scaleAlpha(
double factor) → Color -
Available on Color, provided by the ColorExtension extension
Scales the alpha channel by a factor. -
toARGB32(
) → int -
Returns a 32-bit value representing this color.
override
-
toHex(
{bool includeHashSign = false, bool includeAlpha = true}) → String -
Available on Color, provided by the ColorExtension extension
Converts this color to hexadecimal string. -
toHSL(
) → HSLColor -
Available on Color, provided by the ColorExtension extension
Converts this color to HSL color space. -
toHSV(
) → HSVColor -
Available on Color, provided by the ColorExtension extension
Converts this color to HSV color space. -
toString(
) → String -
A string representation of this object.
inherited
-
withAlpha(
int a) → ColorShades -
Returns a new color that matches this color with the alpha channel
replaced with
a(which ranges from 0 to 255).override -
withBlue(
int b) → ColorShades -
Returns a new color that matches this color with the blue channel replaced
with
b(which ranges from 0 to 255).override -
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).override -
withLuminance(
double luminance) → Color -
Available on Color, provided by the ColorExtension extension
Sets the luminance (lightness) of this 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).override -
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).override -
withValues(
{double? alpha, double? red, double? green, double? blue, ColorSpace? colorSpace}) → Color -
Returns a new color with the provided components updated.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
-
operator [](
dynamic index) → Color -
Returns an element of the swatch table.
override
Static Methods
Constants
-
shadeValues
→ const List<
int> - Standard shade values used in color palettes.