Module color

Source
Expand description

Color items, including everything from rgb, hsb/l/v, lap, alpha, luma and more, provided by the palette crate.

See the named module for a set of provided color constants.

Modules§

blend
Color blending and blending equations.
chromatic_adaptation
Convert colors from one reference white point to another
conv
This module provides some more flexible conversions and aims to fill the gaps within the From and Into implementations provided by the palette library.
encoding
Various encoding traits, types and standards.
float
Floating point trait
gradient
Types for interpolation between multiple colors.
luma
Luminance types.
named
A collection of named color constants. Can be toggled with the "named" and "named_from_str" Cargo features.
rgb
RGB types, spaces and standards.
white_point
Defines the tristimulus values of the CIE Illuminants.

Structs§

Alpha
An alpha component wrapper for colors.
Gradient
A linear interpolation between colors.
Hsl
Linear HSL color space.
Hsv
Linear HSV color space.
Hwb
Linear HWB color space.
Lab
The CIE L*a*b* (CIELAB) color space.
LabHue
A hue type for the CIE L*a*b* family of color spaces.
Lch
CIE L*C*h°, a polar version of CIE L*a*b*.
OutOfBounds
The error type for a color conversion that converted a color into a color with invalid values.
RgbHue
A hue type for the RGB family of color spaces.
Xyz
The CIE 1931 XYZ color space.
Yxy
The CIE 1931 Yxy (xyY) color space.

Constants§

ALICEBLUE
ANTIQUEWHITE
AQUA
AQUAMARINE
AZURE
BEIGE
BISQUE
BLACK
BLANCHEDALMOND
BLUE
BLUEVIOLET
BROWN
BURLYWOOD
CADETBLUE
CHARTREUSE
CHOCOLATE
CORAL
CORNFLOWERBLUE
CORNSILK
CRIMSON
CYAN
DARKBLUE
DARKCYAN
DARKGOLDENROD
DARKGRAY
DARKGREEN
DARKGREY
DARKKHAKI
DARKMAGENTA
DARKOLIVEGREEN
DARKORANGE
DARKORCHID
DARKRED
DARKSALMON
DARKSEAGREEN
DARKSLATEBLUE
DARKSLATEGRAY
DARKSLATEGREY
DARKTURQUOISE
DARKVIOLET
DEEPPINK
DEEPSKYBLUE
DIMGRAY
DIMGREY
DODGERBLUE
FIREBRICK
FLORALWHITE
FORESTGREEN
FUCHSIA
GAINSBORO
GHOSTWHITE
GOLD
GOLDENROD
GRAY
GREEN
GREENYELLOW
GREY
HONEYDEW
HOTPINK
INDIANRED
INDIGO
IVORY
KHAKI
LAVENDER
LAVENDERBLUSH
LAWNGREEN
LEMONCHIFFON
LIGHTBLUE
LIGHTCORAL
LIGHTCYAN
LIGHTGOLDENRODYELLOW
LIGHTGRAY
LIGHTGREEN
LIGHTGREY
LIGHTPINK
LIGHTSALMON
LIGHTSEAGREEN
LIGHTSKYBLUE
LIGHTSLATEGRAY
LIGHTSLATEGREY
LIGHTSTEELBLUE
LIGHTYELLOW
LIME
LIMEGREEN
LINEN
MAGENTA
MAROON
MEDIUMAQUAMARINE
MEDIUMBLUE
MEDIUMORCHID
MEDIUMPURPLE
MEDIUMSEAGREEN
MEDIUMSLATEBLUE
MEDIUMSPRINGGREEN
MEDIUMTURQUOISE
MEDIUMVIOLETRED
MIDNIGHTBLUE
MINTCREAM
MISTYROSE
MOCCASIN
NAVAJOWHITE
NAVY
OLDLACE
OLIVE
OLIVEDRAB
ORANGE
ORANGERED
ORCHID
PALEGOLDENROD
PALEGREEN
PALETURQUOISE
PALEVIOLETRED
PAPAYAWHIP
PEACHPUFF
PERU
PINK
PLUM
POWDERBLUE
PURPLE
REBECCAPURPLE
RED
ROSYBROWN
ROYALBLUE
SADDLEBROWN
SALMON
SANDYBROWN
SEAGREEN
SEASHELL
SIENNA
SILVER
SKYBLUE
SLATEBLUE
SLATEGRAY
SLATEGREY
SNOW
SPRINGGREEN
STEELBLUE
TAN
TEAL
THISTLE
TOMATO
TURQUOISE
VIOLET
WHEAT
WHITE
WHITESMOKE
YELLOW
YELLOWGREEN

Traits§

Blend
A trait for colors that can be blended together.
Component
Common trait for color components.
ComponentWise
Perform a unary or binary operation on each component of a color.
ConvertFrom
A trait for converting one color from another.
ConvertInto
A trait for converting a color into another.
FromColor
FromColor provides conversion from the colors.
GetHue
A trait for colors where a hue may be calculated.
Hue
A trait for colors where the hue can be manipulated without conversion.
IntoColor
IntoColor provides conversion to the colors.
IntoLinSrgba
Types that may be converted directly into a linear sRGBA color representation.
Limited
A trait for clamping and checking if colors are within their ranges.
Mix
A trait for linear color interpolation.
Pixel
Represents colors that can be serialized and deserialized from raw color components.
Saturate
A trait for colors where the saturation (or chroma) can be manipulated without conversion.
Shade
The Shade trait allows a color to be lightened or darkened.

Functions§

gray
A short-hand constructor for Gray::new.
hsl
A short-hand constructor for Hsl::new(RgbHue::from_degrees(h * 360.0), s, l).
hsla
A short-hand constructor for Hsla::new(RgbHue::from_degrees(h * 360.0), s, l, a).
hsv
A short-hand constructor for Hsv::new(RgbHue::from_degrees(h * 360.0), s, v).
hsva
A short-hand constructor for Hsva::new(RgbHue::from_degrees(h * 360.0), s, v, a).
lin_srgb
A short-hand constructor for LinSrgb::new.
lin_srgba
A short-hand constructor for LinSrgba::new.
rgb
A short-hand constructor for Rgb::new.
rgb8
A short-hand constructor for Rgb::<u8>::new .
rgb_u32
Create a new color from a hexadecimal int literal
rgba
A short-hand constructor for Rgba::new.
rgba8
A short-hand constructor for Rgba<u8>::new.
srgb
A short-hand constructor for Srgb::new.
srgb8
A short-hand constructor for Srgb<u8>::new.
srgba
A short-hand constructor for Srgba::new.
srgba8
A short-hand constructor for Srgba<u8>::new.

Type Aliases§

DefaultScalar
The default scalar value for working with color components, hues, etc.
GammaLuma
Gamma 2.2 encoded luminance.
GammaLumaa
Gamma 2.2 encoded luminance with an alpha component.
GammaSrgb
Gamma 2.2 encoded sRGB.
GammaSrgba
Gamma 2.2 encoded sRGB with an alpha component.
Gray
A color represented as gray intensity.
Hsla
Linear HSL with an alpha component. See the Hsla implementation in Alpha.
Hsva
Linear HSV with an alpha component. See the Hsva implementation in Alpha.
Hwba
Linear HWB with an alpha component. See the Hwba implementation in Alpha.
Laba
CIE L*a*b* (CIELAB) with an alpha component. See the Laba implementation in Alpha.
Lcha
CIE L*C*h° with an alpha component. See the Lcha implementation in Alpha.
LinLuma
Linear luminance.
LinLumaa
Linear luminance with an alpha component.
LinSrgb
Linear sRGB.
LinSrgba
Linear sRGB with an alpha component.
Mat3
A 9 element array representing a 3x3 matrix
Rgb
A color represented as red, green and blue intensities.
Rgb8
The same as Rgb, but with u8’s.
Rgba
The same as Rgb, but with an alpha value representing opacity.
Rgba8
The same as Rgba, but with u8’s.
Srgb
Nonlinear sRGB.
SrgbLuma
sRGB encoded luminance.
SrgbLumaa
sRGB encoded luminance with an alpha component.
Srgba
Nonlinear sRGB with an alpha component.
Xyza
CIE 1931 XYZ with an alpha component. See the Xyza implementation in Alpha.
Yxya
CIE 1931 Yxy (xyY) with an alpha component. See the Yxya implementation in Alpha.

Derive Macros§

FromColor
IntoColor
Pixel