ColorPalette class Null safety

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
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 in colorPalette.
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 of seed.
factory

Properties

blue ColorModel
Returns the color with the most bluest hue. (240°)
read-only, inherited
blueViolet ColorModel
Returns the color with the most blue-violet hue. (270°)
read-only, inherited
brightest ColorModel
Returns the color with the highest perceived brightness value.
read-only, inherited
colors List<ColorModel>
The colors contained in the palette.
final, inherited
cyan ColorModel
Returns the color with the most cyan hue. (210°)
read-only, inherited
darkest ColorModel
Returns the color with the lowest lightness value.
read-only, inherited
deepest ColorModel
Returns the color with the highest saturation value.
read-only, inherited
dimmest ColorModel
Returns the color with the lowest perceived brightness value.
read-only, inherited
dullest ColorModel
Returns the color with the lowest saturation value.
read-only, inherited
first ColorModel
Returns the first element.
read / write, inherited-getter, override-setter
green ColorModel
Returns the color with the greenest hue. (180°)
read-only, inherited
hashCode int
The hash code for this object.
read-only, inherited
isEmpty bool
Whether this collection has no elements.
read-only, inherited
isNotEmpty bool
Whether this collection has at least one element.
read-only, inherited
iterator Iterator<ColorModel>
Returns a new Iterator that allows iterating the elements of this Iterable.
read-only, inherited
last ColorModel
Returns the last element.
read / write, inherited-getter, override-setter
leastIntense ColorModel
Returns the color with the lowest intensity value.
read-only, inherited
length int
The number of colors in the palette.
read / write, inherited
lightest ColorModel
Returns the color with the highest lightness value.
read-only, inherited
magenta ColorModel
Returns the color with the most magenta hue. (330°)
read-only, inherited
mostIntense ColorModel
Returns the color with the highest intensity value.
read-only, inherited
muted ColorModel
Returns the color with the lowest combined saturation and brightness values.
read-only, inherited
orange ColorModel
Returns the color with the orangest hue. (60°)
read-only, inherited
red ColorModel
Returns the color with the reddest hue. (0°)
read-only, inherited
redOrange ColorModel
Returns the color with the most red-orange hue. (30°)
read-only, inherited
reversed Iterable<ColorModel>
An Iterable of the objects in this list in reverse order.
read-only, inherited
richest ColorModel
Returns the color with the highest combined saturation and brightness values.
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
single ColorModel
Checks that this iterable has only one element, and returns that element.
read-only, inherited
violet ColorModel
Returns the color with the most violet hue. (300°)
read-only, inherited
yellow ColorModel
Returns the color with the yellowest hue. (120°)
read-only, inherited
yellowGreen ColorModel
Returns the color with the most yellow-green hue. (150°)
read-only, inherited
yellowOrange ColorModel
Returns the color with the most yellow-orange hue. (90°)
read-only, inherited

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 at 270 degrees.
inherited
elementAt(int index) ColorModel
Returns the indexth 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
Returns 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>
Returns 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 position index in this list.
override
insertAll(int index, Iterable<ColorModel> colors) → void
Inserts all objects of iterable at position index 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
Returns 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 non-existent 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
Returns the single element that satisfies test.
inherited
skip(int count) Iterable<ColorModel>
Returns an Iterable that provides all but the first count elements.
inherited
skipWhile(bool test(ColorModel)) Iterable<ColorModel>
Returns an Iterable that skips leading elements while test 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 and end.
inherited
take(int count) Iterable<ColorModel>
Returns a lazy iterable of the count first elements of this iterable.
inherited
takeWhile(bool test(ColorModel)) Iterable<ColorModel>
Returns 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 at 90 degrees.
inherited
where(bool test(ColorModel)) Iterable<ColorModel>
Returns a new lazy Iterable with all elements that satisfy the predicate test.
inherited
whereType<T>() Iterable<T>
Returns 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 to value.
override