Crate color_lib

Source
Expand description

This library implements the color representations RGB, HSV, HSL, and HSI with functions to convert between each type of representations. It also implements the Color trait and ColorMap trait which can be used to define custom colors and color maps.

This library is made to help implement colors in other libraries like plotting or other visualization libraries with shortcuts for common color maps in the “colors” and “maps” module.

Modules§

colors
This module includes all default colors for quick use
maps
This module includes all default color maps for quick use
utils
This module contains utility functions for use in color conversion. Currently it contains functions to convert between any base color representation used in this library. Other utility functions may be added later.

Structs§

ColorHSIA
A struct for defining a single color in HSIA space all values are between 0 and 1
ColorHSLA
A struct for defining a single color in HSLA space all values are between 0 and 1
ColorHSVA
A struct for defining a single color in HSLV space all values are between 0 and 1
ColorND
A generic N-dimensional color, all components are clamped between 0 and 1
ColorRGBA
A struct for defining a single color in RGBA space all values are between 0 and 1

Enums§

ColorType
A simple enum type for determining which format is the base format of a color trait, this is used to implement the correct default functions such that only one color return function needs to be implemented

Traits§

Color
Defines a single color which can be expressed in RGBA
ColorMap
Defines a color map which can convert a N-dimensional color into a normal color