CmykColor class

A color in the CMYK color space.

The CMYK color space contains channels for cyan, magenta, yellow, and black.

Implemented types
Available extensions

Constructors

CmykColor(num cyan, num magenta, num yellow, num black, [int alpha = 255])
A color in the CMYK color space.
const
CmykColor.extrapolate(List<double> values)
Constructs a CmykColor from a list of cmyk values on a 0 to 1 scale.
factory
CmykColor.from(ColorModel color)
Constructs a CmykColor from color.
factory
CmykColor.fromColor(Color color)
Constructs a CmykColor from color.
factory
CmykColor.fromHex(String hex)
Constructs a CmykColor from a RGB hex color.
factory
CmykColor.fromList(List<num> values)
Constructs a CmykColor from a list of cmyk values.
factory
CmykColor.random({num minCyan = 0, num maxCyan = 100, num minMagenta = 0, num maxMagenta = 100, num minYellow = 0, num maxYellow = 100, num minBlack = 0, num maxBlack = 100, int? seed})
Generates a CmykColor at random.
factory

Properties

alpha int
The alpha value of this color.
finalinherited
black num
The black value of this color.
finalinherited
blue int
The blue value of this color.
no setterinherited
chroma double
Calculates a value representing this color's lightness on a linear scale.
no setterinherited
cyan num
The cyan value of this color.
finalinherited
green int
The green value of this color.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
hex String
Returns this as a hexidecimal string.
no setterinherited
hue num
Gets the hue value of this color.
no setterinherited
inverted CmykColor
Inverts the values of this ColorModel, excluding alpha, in its own color space.
no setter
isBlack bool
Returns true if this color is pure black.
no setterinherited
isMonochromatic bool
Returns true if this color is monochromatic.
no setterinherited
isWhite bool
Returns true if this color is pure white.
no setterinherited
magenta num
The magenta value of this color.
finalinherited
opacity double
The alpha value as a double normalized to a 0.0 to 1.0 range.
no setterinherited
opposite CmykColor
Returns the color with the hue opposite of this colors'.
no setter
red int
The red value of this color.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
saturation num
The saturation value of this color. Color spaces without a saturation value will be converted to HSL to retrieve the value.
no setterinherited
value int
A 32 bit value representing this color.
no setteroverride
yellow num
The yellow value of this color.
finalinherited

Methods

castTo(ColorModel other) → ColorModel
Converts this color to other's color space.
inherited
computeLuminance() double
Returns a brightness value between 0 for darkest and 1 for lightest.
inherited
convert(ColorModel other) CmykColor
Converts other to this color's color space.
cooler(num amount, {bool relative = true}) CmykColor
Adjusts the hue of this color by amount towards 270 degrees, capping the value at 270.
copyWith({num? cyan, num? magenta, num? yellow, num? black, int? alpha}) CmykColor
Returns a copy of this color modified with the provided values.
distanceTo(ColorModel color) double
Returns the distance between this color's hue and color's hue in degrees.
inherited
equals(ColorModel color) bool
Compares colors in the RGB color space.
inherited
interpolate(ColorModel end, double step) CmykColor
Interpolates to step between this and end.
lerpTo(ColorModel color, int steps, {ColorSpace? colorSpace, bool excludeOriginalColors = false}) List<CmykColor>
Returns the interpolated steps between this color and color.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rotateHue(num amount) CmykColor
Rotates the hue of this color by amount in degrees.
rotateHueRad(double amount) CmykColor
Rotates the hue of this color by amount in radians.
toCmykColor() CmykColor
Converts this to the CMYK color space.
toFactoredList() List<double>
Returns a fixed-length list containing the cyan, magenta, yelllow, and black values factored to be on 0 to 1 scale.
inherited
toFactoredListWithAlpha() List<double>
Returns a fixed-length list containing the cyan, magenta, yelllow, black, and alpha values factored to be on 0 to 1 scale.
inherited
toHsbColor() HsbColor
Converts this to the HSV color space.
inherited
toHsiColor() HsiColor
Converts this to the HSI color space.
inherited
toHslColor() HslColor
Converts this to the HSL color space.
inherited
toHspColor() HspColor
Converts this to the HSP color space.
inherited
toLabColor() LabColor
Converts this to the LAB color space.
inherited
toList() List<num>
Returns a fixed-length list containing the cyan, magenta, yellow, and black values, in that order.
inherited
toListWithAlpha() List<num>
Returns a fixed-length list containing the cyan, magenta, yellow, black, and alpha values, in that order.
inherited
toOklabColor() OklabColor
Converts this to the Oklab color space.
inherited
toRgbColor() RgbColor
Converts this to the RGB color space.
inherited
toString() String
A string representation of this object.
inherited
toXyzColor() XyzColor
Converts this to the XYZ color space.
inherited
warmer(num amount, {bool relative = true}) CmykColor
Adjusts the hue of this color by amount towards 90 degrees, capping the value at 90.
withAlpha(int alpha) CmykColor
Returns this CmykColor modified with the provided alpha value.
withBlue(num blue) CmykColor
Returns a new color that matches this color with the blue channel replaced with b (which ranges from 0 to 255).
override
withChroma(double chroma) CmykColor
Converts this color to the Oklab color space, calculates and applies a new lightness value from the proivded chroma value, and converts it back to the original color space.
withGreen(num green) CmykColor
Returns a new color that matches this color with the green channel replaced with g (which ranges from 0 to 255).
override
withHue(num hue) CmykColor
Returns this XyzColor modified with the provided hue value.
withOpacity(double opacity) CmykColor
Returns this ColorModel with the provided opacity value.
withRed(num red) CmykColor
Returns a new color that matches this color with the red channel replaced with r (which ranges from 0 to 255).
override
withValues(List<num> values) CmykColor
Returns a color in this color's color space with the values provided.

Operators

operator ==(Object other) bool
The equality operator.
inherited