ColorPalette class
Wraps a list of ColorModels with additional getters and methods; with constructors for generating new color palettes, as well as methods and operators for modifying and extracting colors from the palette.
Color can be used interchangeably with ColorModels by all relevant methods and constructors.
- Available Extensions
Constructors
-
ColorPalette(List<
ColorModel> colors) -
Wraps a list of ColorModels with additional getters and methods;
with constructors for generating new color palettes, as well as methods
and operators for modifying and extracting colors from the palette.
const
- ColorPalette.adjacent(Color seed, {int numberOfColors = 5, num distance = 30, num hueVariability = 0, num saturationVariability = 0, num brightnessVariability = 0, bool perceivedBrightness = true, bool growable = true, bool unique = false})
-
Generates a ColorPalette by selecting colors with hues
to both sides of
color
's hue value.factory - ColorPalette.empty()
-
Returns a ColorPalette with an empty list of colors.
factory
-
ColorPalette.from(List<
Color> colors) -
Constructs a ColorPalette from
colors
.factory -
ColorPalette.opposites(ColorPaletteBase<
dynamic, ColorModel> colorPalette, {bool insertOpposites = true, bool growable = true, bool unique = false}) -
Generates a ColorPalette from
colorPalette
by appending or inserting the opposite colors of every color incolorPalette
.factory - ColorPalette.polyad(Color seed, {int numberOfColors = 5, num hueVariability = 0, num saturationVariability = 0, num brightnessVariability = 0, bool perceivedBrightness = true, bool clockwise = true, bool growable = true, bool unique = false})
-
Generates a ColorPalette by selecting colors with hues
evenly spaced around the color wheel from
color
.factory - ColorPalette.random(int numberOfColors, {ColorSpace colorSpace = ColorSpace.rgb, num minHue = 0, num maxHue = 360, num minSaturation = 0, num maxSaturation = 100, num minBrightness = 0, num maxBrightness = 100, bool perceivedBrightness = true, bool distributeHues = true, num? distributionVariability, bool clockwise = true, bool growable = true, bool unique = false})
-
Generates a ColorPalette with
numberOfColors
at random, constrained within the specified hue, saturation, and brightness ranges.factory - ColorPalette.splitComplimentary(Color seed, {int numberOfColors = 3, num distance = 30, num hueVariability = 0, num saturationVariability = 0, num brightnessVariability = 0, bool perceivedBrightness = true, bool growable = true, bool unique = false})
-
Generates a ColorPalette by selecting colors to both sides
of the color with the opposite
hue
ofcolor
.factory
Properties
- blue → ColorModel
-
Returns the color with the most bluest hue. (240°)
no setterinherited
- blueViolet → ColorModel
-
Returns the color with the most blue-violet hue. (270°)
no setterinherited
- brightest → ColorModel
-
Returns the color with the highest perceived brightness value.
no setterinherited
-
colors
→ List<
ColorModel> -
The colors contained in the palette.
final
- cyan → ColorModel
-
Returns the color with the most cyan hue. (210°)
no setterinherited
- darkest → ColorModel
-
Returns the color with the lowest lightness value.
no setterinherited
- deepest → ColorModel
-
Returns the color with the highest saturation value.
no setterinherited
- dimmest → ColorModel
-
Returns the color with the lowest perceived brightness value.
no setterinherited
- dullest → ColorModel
-
Returns the color with the lowest saturation value.
no setterinherited
- first ↔ Color
-
The first element.
getter/setter pairinherited-getteroverride-setter
- green → ColorModel
-
Returns the color with the greenest hue. (180°)
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
Whether this collection has no elements.
no setterinherited
- isNotEmpty → bool
-
Whether this collection has at least one element.
no setterinherited
-
iterator
→ Iterator<
Color> -
A new
Iterator
that allows iterating the elements of thisIterable
.no setterinherited - last ↔ Color
-
The last element.
getter/setter pairinherited-getteroverride-setter
- leastIntense → ColorModel
-
Returns the color with the lowest intensity value.
no setterinherited
- length ↔ int
-
The number of colors in the palette.
getter/setter pairinherited
- lightest → ColorModel
-
Returns the color with the highest lightness value.
no setterinherited
- magenta → ColorModel
-
Returns the color with the most magenta hue. (330°)
no setterinherited
- mostIntense → ColorModel
-
Returns the color with the highest intensity value.
no setterinherited
- muted → ColorModel
-
Returns the color with the lowest combined saturation
and brightness values.
no setterinherited
- orange → ColorModel
-
Returns the color with the orangest hue. (60°)
no setterinherited
- red → ColorModel
-
Returns the color with the reddest hue. (0°)
no setterinherited
- redOrange → ColorModel
-
Returns the color with the most red-orange hue. (30°)
no setterinherited
-
reversed
→ Iterable<
Color> -
An Iterable of the objects in this list in reverse order.
no setterinherited
- richest → ColorModel
-
Returns the color with the highest combined saturation
and brightness values.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- single → Color
-
Checks that this iterable has only one element, and returns that element.
no setterinherited
- violet → ColorModel
-
Returns the color with the most violet hue. (300°)
no setterinherited
- yellow → ColorModel
-
Returns the color with the yellowest hue. (120°)
no setterinherited
- yellowGreen → ColorModel
-
Returns the color with the most yellow-green hue. (150°)
no setterinherited
- yellowOrange → ColorModel
-
Returns the color with the most yellow-orange hue. (90°)
no setterinherited
Methods
-
add(
Color color) → void -
Adds
value
to the end of this list, extending the length by one.override -
addAll(
Iterable< Color> colors) → void -
Appends all objects of
iterable
to the end of this list.override -
any(
bool test(Color)) → bool -
Checks whether any element of this iterable satisfies
test
.inherited -
asMap(
) → Map< int, Color> -
An unmodifiable Map view of this list.
inherited
-
cast<
R> () → List< R> -
Returns a view of this list as a list of
R
instances.inherited -
clear(
) → void -
Removes all objects from this list; the length of the list becomes zero.
inherited
-
closest(
Color color) → Color -
Returns the color with the values closest to
color
. -
contains(
Object? color) → bool -
Whether the collection contains an element equal to
element
.override -
cooler(
num amount, {bool relative = true}) → void -
Adjusts the hue of every color in the palette to be cooler by
amount
, capping the value at270
degrees.inherited -
elementAt(
int index) → Color -
Returns the
index
th element.inherited -
every(
bool test(Color)) → bool -
Checks whether every element of this iterable satisfies
test
.inherited -
expand<
T> (Iterable< T> f(Color)) → Iterable<T> -
Expands each element of this Iterable into zero or more elements.
inherited
-
fillRange(
int start, int end, [Color? fillColor]) → void -
Overwrites a range of elements with
fillValue
.override -
firstWhere(
bool test(Color), {Color orElse()?}) → Color -
The first element that satisfies the given predicate
test
.inherited -
fold<
T> (T initialValue, T combine(T, Color)) → T -
Reduces a collection to a single value by iteratively combining each
element of the collection with an existing value
inherited
-
followedBy(
Iterable< Color> other) → Iterable<ColorModel> -
Creates the lazy concatenation of this iterable and
other
.override -
forEach(
void f(Color)) → void -
Invokes
action
on each element of this iterable in iteration order.inherited -
furthest(
Color color) → Color -
Returns the color with the values furthest from
color
. -
getRange(
int start, int end) → Iterable< Color> -
Creates an Iterable that iterates over a range of elements.
inherited
-
indexOf(
Color color, [int start = 0]) → int -
The first index of
element
in this list.override -
indexWhere(
bool test(Color), [int start = 0]) → int -
The first index in the list that satisfies the provided
test
.inherited -
insert(
int index, Color color) → void -
Inserts
element
at positionindex
in this list.override -
insertAll(
int index, Iterable< Color> colors) → void -
Inserts all objects of
iterable
at positionindex
in this list.override -
invert(
) → void -
Inverts the values of every color in the palette in their respective
color spaces.
inherited
-
join(
[String separator = '']) → String -
Converts each element to a String and concatenates the strings.
inherited
-
lastIndexOf(
Color color, [int? start]) → int -
The last index of
element
in this list.inherited -
lastIndexWhere(
bool test(Color), [int? start]) → int -
The last index in the list that satisfies the provided
test
.inherited -
lastWhere(
bool test(Color), {Color orElse()?}) → Color -
The last element that satisfies the given predicate
test
.inherited -
map<
T> (T f(Color)) → Iterable< T> -
The current elements of this iterable modified by
toElement
.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
opposite(
) → void -
Rotates the hue of every color in the palette by
180
degrees.inherited -
reduce(
Color combine(Color, Color)) → Color -
Reduces a collection to a single value by iteratively combining elements
of the collection using the provided function.
inherited
-
remove(
Object? color) → bool -
Removes the first occurrence of
value
from this list.inherited -
removeAt(
int index) → Color -
Removes the object at position
index
from this list.inherited -
removeLast(
) → Color -
Removes and returns the last object in this list.
inherited
-
removeRange(
int start, int end) → void -
Removes a range of elements from the list.
inherited
-
removeWhere(
bool test(Color)) → void -
Removes all objects from this list that satisfy
test
.inherited -
replaceRange(
int start, int end, Iterable< Color> replacement) → void -
Replaces a range of elements with the elements of
replacements
.override -
retainWhere(
bool test(Color)) → void -
Removes all objects from this list that fail to satisfy
test
.inherited -
reverse(
) → void -
Reverses the order of the colors in the palette.
inherited
-
rotateHue(
num amount) → void -
Rotates the hue of every color in the palette by
amount
.inherited -
setAll(
int index, Iterable< Color> colors) → void -
Overwrites elements with the objects of
iterable
.override -
setRange(
int start, int end, Iterable< Color> colors, [int skipCount = 0]) → void -
Writes some elements of
iterable
into a range of this list.override -
shuffle(
[Random? random]) → void -
Shuffles the elements of this list randomly.
inherited
-
singleWhere(
bool test(Color), {Color orElse()?}) → Color -
The single element that satisfies
test
.inherited -
skip(
int count) → Iterable< Color> -
Creates an Iterable that provides all but the first
count
elements.inherited -
skipWhile(
bool test(Color)) → Iterable< Color> -
Creates an
Iterable
that skips leading elements whiletest
is satisfied.inherited -
sort(
[int compare(Color, Color)?]) → void -
Sorts this list according to the order specified by the
compare
function.inherited -
sortBy(
ColorSortingProperty property) → void -
Sorts the palette by
property
.inherited -
sortByHue(
{num startingFrom = 0, bool clockwise = true}) → void -
Sorts the palette by each colors hue.
inherited
-
sublist(
int start, [int? end]) → List< Color> -
Returns a new list containing the elements between
start
andend
.inherited -
take(
int count) → Iterable< Color> -
Creates a lazy iterable of the
count
first elements of this iterable.inherited -
takeWhile(
bool test(Color)) → Iterable< Color> -
Creates a lazy iterable of the leading elements satisfying
test
.inherited -
toColors(
{bool growable = true}) → List< Color> -
Returns the color palette as a list of
Color
s. -
toColorSpace(
ColorSpace colorSpace) → void -
Converts all colors into the
ColorModel
represented bycolorSpace
.inherited -
toList(
{bool growable = true}) → List< Color> -
Creates a List containing the elements of this Iterable.
inherited
-
toSet(
) → Set< Color> -
Creates a Set containing the same elements as this iterable.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
warmer(
num amount, {bool relative = true}) → void -
Adjusts the hue of every color in the palette to be warmer by
amount
, capping the value at90
degrees.inherited -
where(
bool test(Color)) → Iterable< Color> -
Creates a new lazy Iterable with all elements that satisfy the
predicate
test
.inherited -
whereType<
T> () → Iterable< T> -
Creates a new lazy Iterable with all elements that have type
T
.inherited
Operators
-
operator +(
Iterable< Color> other) → ColorPalette -
Returns the concatenation of this list and
other
.override -
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
int index) → ColorModel -
The object at the given
index
in the list. -
operator []=(
int index, Color value) → void -
Sets the value at the given
index
in the list tovalue
.override