Crate palette [] [src]

A library that makes linear color calculations and conversion easy and accessible for anyone. It provides both precision tools that lets you work in exactly the color space you want to, as well as a general color type that abstracts away some of the technical details.

Linear?

Colors in, for example, images are often "gamma corrected" or stored in sRGB format as a compression method and to prevent banding. This is also a bit of a legacy from the ages of the CRT monitors, where the output from the electron guns was nonlinear. The problem is that these formats doesn't represent the actual intensities, and the compression has to be reverted to make sure that any operations on the colors are accurate. This library uses a completely linear work flow, and comes with the tools for transitioning between linear and non-linear RGB.

Reexports

pub use gradient::Gradient;

Modules

gradient

Types for interpolation between multiple colors.

Structs

Hsl

Linear HSL color space with an alpha component.

Hsv

Linear HSV color space with an alpha component.

Lab

The CIE L*a*b* (CIELAB) color space with an alpha component.

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*, with an alpha component.

Luma

Linear luminance with an alpha component.

Rgb

Linear RGB with an alpha component.

RgbHue

A hue type for the RGB family of color spaces.

Xyz

The CIE 1931 XYZ color space with an alpha component.

Enums

Color

A generic color type.

Traits

ColorSpace

Common functionality for color spaces.

GetHue

A trait for colors where a hue may be calculated.

Hue

A trait for colors where the hue can be manipulated without conversion.

Mix

A trait for linear color interpolation.

RgbPixel

A conversion trait for RGB pixel types.

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.