ShadedColor class
A ColorSwatch with numbered shade variants.
Access shades using the index operator: Colors.grey[120].
See also:
- AccentColor, for colors with named shade variants
- Colors.grey, which uses this class
- Inheritance
-
- Object
- Color
- ColorSwatch<
int> - ShadedColor
- Available extensions
Constructors
-
ShadedColor(int primary, Map<
int, Color> swatch) -
Creates a shaded color with the given primary value and swatch.
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
- colorSpace → ColorSpace
-
The color space of this color.
finalinherited
- colorValue → int
-
Available on Color, provided by the ColorExtension extension
Get the color value as an integer.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
-
keys
→ Iterable<
int> -
Returns the valid keys for accessing operator[].
no setterinherited
- opacity → double
-
The alpha channel of this color as a double.
no setterinherited
- 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
- value → int
-
A 32 bit value representing this color.
no setterinherited
Methods
-
basedOnLuminance(
{Color darkColor = Colors.black, Color lightColor = Colors.white}) → Color -
Available on Color, provided by the ColorExtension extension
Get a constrast color based on the luminance of this color. If the luminance is bigger than 0.5,darkColoris used, otherwiselightColoris used. -
computeLuminance(
) → double -
Returns a brightness value between 0 for darkest and 1 for lightest.
inherited
-
lerpWith(
Color color, double t) → Color -
Available on Color, provided by the ColorExtension extension
Lerp this color with another color. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toAccentColor(
{double darkestFactor = 0.38, double darkerFactor = 0.30, double darkFactor = 0.15, double lightFactor = 0.15, double lighterFactor = 0.30, double lightestFactor = 0.38}) → AccentColor -
Available on Color, provided by the ColorExtension extension
Creates a new accent color based on this color. This provides the shades by lerping this color with Colors.black if dark or darker, and with Colors.white if light or lighter. -
toARGB32(
) → int -
Returns a 32-bit value representing this color.
inherited
-
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 -
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 with the provided components updated.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
int key) → Color -
Returns the shade at the given
key.override