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.
- Inheritance
-
- Object
- ColorPaletteBase<
ColorModel, ColorModel> - ColorPalette
- 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(ColorModel 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
seed
's hue value.factory - ColorPalette.empty({bool unique = false})
-
Returns a ColorPalette with an empty list of 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(ColorModel 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
seed
.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(ColorModel 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
ofseed
.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.
finalinherited
- 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 ↔ ColorModel
-
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<
ColorModel> -
A new
Iterator
that allows iterating the elements of thisIterable
.no setterinherited - last ↔ ColorModel
-
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<
ColorModel> -
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 → ColorModel
-
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(
ColorModel color) → void -
Adds
value
to the end of this list, extending the length by one.override -
addAll(
Iterable< ColorModel> colors) → void -
Appends all objects of
iterable
to the end of this list.override -
any(
bool test(ColorModel)) → bool -
Checks whether any element of this iterable satisfies
test
.inherited -
asMap(
) → Map< int, ColorModel> -
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(
ColorModel color) → ColorModel -
Returns the color with the values closest to
color
.inherited -
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) → ColorModel -
Returns the
index
th element.inherited -
every(
bool test(ColorModel)) → bool -
Checks whether every element of this iterable satisfies
test
.inherited -
expand<
T> (Iterable< T> f(ColorModel)) → Iterable<T> -
Expands each element of this Iterable into zero or more elements.
inherited
-
fillRange(
int start, int end, [ColorModel? fillColor]) → void -
Overwrites a range of elements with
fillValue
.override -
firstWhere(
bool test(ColorModel), {ColorModel orElse()?}) → ColorModel -
The first element that satisfies the given predicate
test
.inherited -
fold<
T> (T initialValue, T combine(T, ColorModel)) → T -
Reduces a collection to a single value by iteratively combining each
element of the collection with an existing value
inherited
-
followedBy(
Iterable< ColorModel> other) → Iterable<ColorModel> -
Creates the lazy concatenation of this iterable and
other
.override -
forEach(
void f(ColorModel)) → void -
Invokes
action
on each element of this iterable in iteration order.inherited -
furthest(
ColorModel color) → ColorModel -
Returns the color with the values furthest from
color
.inherited -
getRange(
int start, int end) → Iterable< ColorModel> -
Creates an Iterable that iterates over a range of elements.
inherited
-
indexOf(
ColorModel color, [int start = 0]) → int -
The first index of
element
in this list.override -
indexWhere(
bool test(ColorModel), [int start = 0]) → int -
The first index in the list that satisfies the provided
test
.inherited -
insert(
int index, ColorModel color) → void -
Inserts
element
at positionindex
in this list.override -
insertAll(
int index, Iterable< ColorModel> 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(
ColorModel color, [int? start]) → int -
The last index of
element
in this list.inherited -
lastIndexWhere(
bool test(ColorModel), [int? start]) → int -
The last index in the list that satisfies the provided
test
.inherited -
lastWhere(
bool test(ColorModel), {ColorModel orElse()?}) → ColorModel -
The last element that satisfies the given predicate
test
.inherited -
map<
T> (T f(ColorModel)) → 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(
ColorModel combine(ColorModel, ColorModel)) → ColorModel -
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) → ColorModel -
Removes the object at position
index
from this list.inherited -
removeLast(
) → ColorModel -
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(ColorModel)) → void -
Removes all objects from this list that satisfy
test
.inherited -
replaceRange(
int start, int end, Iterable< ColorModel> replacement) → void -
Replaces a range of elements with the elements of
replacements
.override -
retainWhere(
bool test(ColorModel)) → 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< ColorModel> colors) → void -
Overwrites elements with the objects of
iterable
.override -
setRange(
int start, int end, Iterable< ColorModel> 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(ColorModel), {ColorModel orElse()?}) → ColorModel -
The single element that satisfies
test
.inherited -
skip(
int count) → Iterable< ColorModel> -
Creates an Iterable that provides all but the first
count
elements.inherited -
skipWhile(
bool test(ColorModel)) → Iterable< ColorModel> -
Creates an
Iterable
that skips leading elements whiletest
is satisfied.inherited -
sort(
[int compare(ColorModel, ColorModel)?]) → 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< ColorModel> -
Returns a new list containing the elements between
start
andend
.inherited -
take(
int count) → Iterable< ColorModel> -
Creates a lazy iterable of the
count
first elements of this iterable.inherited -
takeWhile(
bool test(ColorModel)) → Iterable< ColorModel> -
Creates a lazy iterable of the leading elements satisfying
test
.inherited -
toColorSpace(
ColorSpace colorSpace) → void -
Converts all colors into the ColorModel represented by
colorSpace
.inherited -
toList(
{bool growable = true}) → List< ColorModel> -
Creates a List containing the elements of this Iterable.
inherited
-
toSet(
) → Set< ColorModel> -
Creates a Set containing the same elements as this iterable.
inherited
-
toString(
) → String -
A string representation of this object.
override
-
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(ColorModel)) → Iterable< ColorModel> -
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< ColorModel> 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.inherited -
operator []=(
int index, ColorModel color) → void -
Sets the value at the given
index
in the list tovalue
.override