colored
1.0.0System for colour representation, conversion, and operation.
About Colored
This is a library for representing and mapping colours between their various spaces.
It currently does not support ICC colour space conversions from colour profile files. This is however planned for a future release. If there are other mappings missing that you need, please file an issue.
How To
For the purposes of this tutorial we assume the package org.shirakumo.alloy.colored
is nicknamed colored
.
Primarily, colours are constructed using color
or one of the specific colour space constructors (rgb
, srgb
, hsv
, hsl
, hsi
, cmyk
, lab
, xyz
).
You can also de/serialise colours from direct integer format using the encode
and decode
functions.
Colours are immutable. As such they can and will be cached wherever possible. Nevertheless, it is not guaranteed that two colours with the same channel values will be eq
. To compare colours, use color=
and color-equal
.
(colored:color= (colored:color 1 0 0) (colored:decode #xFF0000)) ; => T
In order to convert colours between different colour spaces, use the convert
function.
Constants
Colored offers a database of standard colours with their associated colour values. You can find these in the org.shirakumo.alloy.colored.colors
package. You can also define new colours using define-color
.
System Information
Definition Index
-
ORG.SHIRAKUMO.ALLOY.COLORED
No documentation provided.-
EXTERNAL STRUCTURE CMYK
No documentation provided. -
EXTERNAL STRUCTURE COLOR
Representation of a colour in some space. A colour is an immutable object and can be emitted into FASLs. Colors can and are cached aggressively thanks to their immutability. Note that an instance returned by a constructor may or may not be EQ to a previously constructed color instance with the same channel values. To properly test equality, use COLOR= or COLOR-EQUAL. Note that the colour channels are stored as SINGLE-FLOATs. Conversion functions to and from integers are available as operations. The floats are not constrained to be within [0,1] and can thus be used to encode high dynamic range. See CHANNELS See A See COLOR (function) See COLOR= See COLOR-EQUAL See RGB See HSV See HSL See HSI See CMYK See LAB
-
EXTERNAL STRUCTURE HSI
No documentation provided. -
EXTERNAL STRUCTURE HSL
No documentation provided. -
EXTERNAL STRUCTURE HSV
No documentation provided. -
EXTERNAL STRUCTURE LAB
No documentation provided. -
EXTERNAL STRUCTURE RGB
No documentation provided. -
EXTERNAL STRUCTURE SRGB
No documentation provided. -
EXTERNAL STRUCTURE XYZ
No documentation provided. -
EXTERNAL FUNCTION A
- INSTANCE
Returns the alpha channel component. 0 means transparent, 1 opaque. See COLOR (type)
-
EXTERNAL FUNCTION A*
- INSTANCE
Returns the green/red channel component. See LAB
-
EXTERNAL FUNCTION ALPHA
- COLOR
Returns the alpha component of the colour. See A
-
EXTERNAL FUNCTION B
- INSTANCE
-
EXTERNAL FUNCTION B*
- INSTANCE
Returns the blue/yellow channel component. See LAB
-
EXTERNAL FUNCTION BLACK
- COLOR
Returns the black component of the colour. If not in CMYK format, is first converted to CMYK. See K
-
EXTERNAL FUNCTION BLUE
- COLOR
Returns the blue component of the colour. If not in RGB format, is first converted to RGB. See B
-
EXTERNAL FUNCTION C
- INSTANCE
-
EXTERNAL FUNCTION CMYK
- C
- M
- Y
- K
- &OPTIONAL
- A
Create a Cyan/Magenta/Yellow/Black component colour. See COLOR (type) See C See M See Y See K
-
EXTERNAL FUNCTION COLOR
- R
- G
- B
- &OPTIONAL
- A
No documentation provided. -
EXTERNAL FUNCTION COLOR-EQUAL
- COLOR
- &REST
- MORE
Returns true if all colours match in the RGB channels. Unlike COLOR=, this ignores the alpha channel. See COLOR (type) See COLOR=
-
EXTERNAL FUNCTION COLOR=
- COLOR
- &REST
- MORE
Returns true if all colours match in all channels. See COLOR (type) See COLOR-EQUAL
-
EXTERNAL FUNCTION COMPUTE-D-WHITEPOINT
- CCT
Computes the xyY coordinates for the CIE standard illuminant series D. CCT must be a CCT reference temperature. See DEFINE-WHITEPOINT
-
EXTERNAL FUNCTION CONVERSION-MATRIX
- FROM
- TO
Returns a linear conversion matrix for the two given colour spaces. Signals an error if no conversion matrix to fit the from/to spaces is known. Standard conversions are known for converting to/from XYZ and the following: :ADOBE-RGB :APPLE-RGB :BEST-RGB :BETA-RGB :BRUCE-RGB :CIE-RGB :COLORMATCH-RGB :DON-RGB-4 :ECI-RGB :EKTA-SPACE-PS5 :NTSC-RGB :PAL-RGB :PROPHOTO-RGB :SMPTE-C-RGB :SRGB :WIDE-GAMUT-RGB The conversion method may be passed to CONVERT via the keywords :SPACE (for a name of a colour space) or :MATRIX for passing a 9-element vector directly. See DEFINE-CONVERSION
-
EXTERNAL FUNCTION (SETF CONVERSION-MATRIX)
- MATRIX
- FROM
- TO
No documentation provided. -
EXTERNAL FUNCTION CYAN
- COLOR
Returns the cyan component of the colour. If not in CMYK format, is first converted to CMYK. See C
-
EXTERNAL FUNCTION DECODE
- INTEGER
- &KEY
- TYPE
- CHANNEL-SIZE
- CHANNELS
Constructs a colour from the given integer colour representation. CHANNEL-SIZE should be the number of bits per channel, and CHANNELS a list in order of the channels. The list should contain symbols naming the channels available to the requested TYPE. For instance, to decode a 16bpc BGRA integer, you would use (decode-color int 16 '(b g r a)) See COLOR (type) See ENCODE
-
EXTERNAL FUNCTION ENCODE
- COLOR
- &KEY
- CHANNEL-SIZE
- CHANNELS
Constructs an integer for the colour using the given integer colour representation. CHANNEL-SIZE should be the number of bits per channel, and CHANNELS a list in order of the channels. The list should contain symbols naming channels available for the colour being encoded. For instance, to encode a 16bpc BGRA integer, you would use (encode-color color 16 '(b g r a)) See COLOR (type) See DECODE
-
EXTERNAL FUNCTION G
- INSTANCE
-
EXTERNAL FUNCTION GRADIENT
- X
- STOPS
Evaluate a colour gradient at a specific point. Returns the linear interpolation of the two colours between the stops designated by X. Each stop in STOPS should be a cons of its position along the gradient and the colour at that stop. See LERP
-
EXTERNAL FUNCTION GREEN
- COLOR
Returns the green component of the colour. If not in RGB format, is first converted to RGB. See G
-
EXTERNAL FUNCTION H
- INSTANCE
-
EXTERNAL FUNCTION HSI
- H
- S
- I
- &OPTIONAL
- A
Create a Hue/Saturation/Intensity component colour. The Hue should be in [0,360[ degrees, the other two values in the [0,1] range. See TO-HSI See HUE See INTENSITY See COLOR (type)
-
EXTERNAL FUNCTION HSL
- H
- S
- L
- &OPTIONAL
- A
Create a Hue/Saturation/Lightness component colour. The Hue should be in [0,360[ degrees, the other two values in the [0,1] range. See TO-HSL See HUE See LIGHTNESS See COLOR (type)
-
EXTERNAL FUNCTION HSV
- H
- S
- V
- &OPTIONAL
- A
Create a Hue/Saturation/Value component colour. The Hue should be in [0,360[ degrees, the other two values in the [0,1] range. See TO-HSV See HUE See SATURATION See VALUE See COLOR (type)
-
EXTERNAL FUNCTION HUE
- COLOR
Returns the hue component of the colour in degrees [0,360[. If not in HSL/HSV/HSI format, is first converted to HSV. See H
-
EXTERNAL FUNCTION I
- INSTANCE
-
EXTERNAL FUNCTION INTENSITY
- COLOR
Returns the intensity component of the colour. If not in HSI format, is first converted to HSI. See I
-
EXTERNAL FUNCTION K
- INSTANCE
-
EXTERNAL FUNCTION L
- INSTANCE
-
EXTERNAL FUNCTION L*
- INSTANCE
Returns the lightness channel component. See LAB
-
EXTERNAL FUNCTION LAB
- L*
- A*
- B*
- &OPTIONAL
- A
Create a CIE LAB colour instance. See COLOR (type) See L* See A* See B*
-
EXTERNAL FUNCTION LIGHTNESS
- COLOR
Returns the lightness component of the colour. If not in HSL format, is first converted to HSL. See L
-
EXTERNAL FUNCTION M
- INSTANCE
-
EXTERNAL FUNCTION MAGENTA
- COLOR
Returns the magenta component of the colour. If not in CMYK format, is first converted to CMYK. See M
-
EXTERNAL FUNCTION R
- INSTANCE
-
EXTERNAL FUNCTION RED
- COLOR
Returns the red component of the colour. If not in RGB format, is first converted to RGB. See R
-
EXTERNAL FUNCTION RGB
- R
- G
- B
- &OPTIONAL
- A
Create a new RGB color instance. See COLOR (type)
-
EXTERNAL FUNCTION S
- INSTANCE
Returns the saturation channel component. See HSV See HSL See HSI See SATURATION
-
EXTERNAL FUNCTION SATURATION
- COLOR
Returns the saturation component of the colour. If not in HSL/HSV/HSI format, is first converted to HSV. See S
-
EXTERNAL FUNCTION SRGB
- R
- G
- B
- &OPTIONAL
- A
Create a new sRGB color instance. This is distinct from RGB by being in a non-linear space. See COLOR (type) See RGB
-
EXTERNAL FUNCTION TEMPERATURE-COLOR
- KELVIN
- &OPTIONAL
- ALPHA
Compute the colour for the corresponding light temperature. The temperature is given in Kelvin and is valid in the range [0,40'000]. Values outside this range will not yield correct colours. Note that the range [0,1'000] is denormalised and will simply correspond to the colour for 1'000K linearly scaled down to zero. Daylight temperatures occur in the range [5'000,6'5000], moonlight temperature is around 4'100K. See COLOR (type)
-
EXTERNAL FUNCTION V
- INSTANCE
-
EXTERNAL FUNCTION VALUE
- COLOR
Returns the value component of the colour. If not in HSV format, is first converted to HSV. See V
-
EXTERNAL FUNCTION WHITEPOINT
- NAME
Returns a reference whitepoint XYZ triplet for the requested name. Signals an error if no whitepoint is known for the given name. The following whitepoints are defined by default: :A :B :C :D50 :D55 :D60 :D65 :D70 :D75 :E :F1 :F2 :F3 :F4 :F5 :F6 :F7 :F8 :F9 :F10 :F11 :F12 :LED-B1 :LED-B2 :LED-B3 :LED-B4 :LED-B5 :LED-BH1 :LED-RGB1 :LED-V1 :LED-V2 The whitepoint may be passed to CONVERT via the :WHITEPOINT keyword, as either the name of a defined whitepoint, or a vector exprsesing the XYZ triplet. See DEFINE-WHITEPOINT
-
EXTERNAL FUNCTION (SETF WHITEPOINT)
- VALUES
- NAME
No documentation provided. -
EXTERNAL FUNCTION XYZ
- X*
- Y*
- Z*
- &OPTIONAL
- A
Create a CIE XYZ colour instance. See COLOR (type) See X* See Y* See Z*
-
EXTERNAL FUNCTION Y
- INSTANCE
-
EXTERNAL FUNCTION YELLOW
- COLOR
Returns the yellow component of the colour. If not in CMYK format, is first converted to CMYK. See Y
-
EXTERNAL GENERIC-FUNCTION CHANNELS
- COLOR
Returns the list of available channels in the colour. Accepts both a COLOR instance and a color type name. See COLOR (type)
-
EXTERNAL GENERIC-FUNCTION CONVERT
- COLOR
- TARGET-TYPE
- &KEY
- WHITEPOINT
- SPACE
- MATRIX
- GAMMA
- &ALLOW-OTHER-KEYS
Convert a colour to a different colour space (type). Direct conversions between any colour space and any other is not guaranteed to be available, and you may have to convert to a common space such as RGB or LAB first and then to your target colour space of choice. Certain conversions may accept additional arguments that influence the process and colour range. See COLOR (type)
-
EXTERNAL GENERIC-FUNCTION LERP
- X
- A
- B
Linearly interpolate between two colours from the same colour space. If the colours are of a different colour space (type), an error is signalled. Each of the colours' channels are interpolated separately.
-
EXTERNAL MACRO DEFINE-COLOR
- NAME
- INT
- &OPTIONAL
- CHANNELS
Define a new color constant. NAME should be a symbol for the constant's name. If the symbol is not interned in any package, the name will automatically be used as a symbol designator in the ORG.SHIRAKUMO.ALLOY.COLORED.COLORS package. If the package is ORG.SHIRAKUMO.ALLOY.COLORED.COLORS, then the symbol is also automatically exported from that package. INT should be an integer describing the full colour, as interpreted by the CONVERSION function. By default this should be an RGB integer. Note that once the constant is defined, its value cannot be changed. See RGB
-
EXTERNAL MACRO DEFINE-CONVERSION
- FROM
- TO
- &BODY
- MATRIX
Defines a new colour space conversion matrix. The matrix should be expressed via 9 entries that form a 3x3 matrix. See CONVERSION-MATRIX
-
EXTERNAL MACRO DEFINE-WHITEPOINT
- NAME
- XY
Defines a new whitepoint. The whitepoint should be a list of two values, the xy chromaticity coordinates in the xyY space. They are then automatically converted and internally stored in the XYZ format. See WHITEPOINT See COMPUTE-D-WHITEPOINT
-
-
ORG.SHIRAKUMO.ALLOY.COLORED.COLORS
No documentation provided.-
EXTERNAL CONSTANT ALICE-BLUE
No documentation provided. -
EXTERNAL CONSTANT ANTIQUE-WHITE
No documentation provided. -
EXTERNAL CONSTANT AQUA
No documentation provided. -
EXTERNAL CONSTANT AQUA-MARINE
No documentation provided. -
EXTERNAL CONSTANT AZURE
No documentation provided. -
EXTERNAL CONSTANT BEIGE
No documentation provided. -
EXTERNAL CONSTANT BISQUE
No documentation provided. -
EXTERNAL CONSTANT BLACK
No documentation provided. -
EXTERNAL CONSTANT BLANCHED-ALMOND
No documentation provided. -
EXTERNAL CONSTANT BLUE
No documentation provided. -
EXTERNAL CONSTANT BLUE-VIOLET
No documentation provided. -
EXTERNAL CONSTANT BROWN
No documentation provided. -
EXTERNAL CONSTANT BURLY-WOOD
No documentation provided. -
EXTERNAL CONSTANT CADET-BLUE
No documentation provided. -
EXTERNAL CONSTANT CHART-REUSE
No documentation provided. -
EXTERNAL CONSTANT CHOCOLATE
No documentation provided. -
EXTERNAL CONSTANT CORAL
No documentation provided. -
EXTERNAL CONSTANT CORN-FLOWER-BLUE
No documentation provided. -
EXTERNAL CONSTANT CORN-SILK
No documentation provided. -
EXTERNAL CONSTANT CRIMSON
No documentation provided. -
EXTERNAL CONSTANT CYAN
No documentation provided. -
EXTERNAL CONSTANT DARK-BLUE
No documentation provided. -
EXTERNAL CONSTANT DARK-CYAN
No documentation provided. -
EXTERNAL CONSTANT DARK-GOLDEN-ROD
No documentation provided. -
EXTERNAL CONSTANT DARK-GRAY
No documentation provided. -
EXTERNAL CONSTANT DARK-GREEN
No documentation provided. -
EXTERNAL CONSTANT DARK-KHAKI
No documentation provided. -
EXTERNAL CONSTANT DARK-MAGENTA
No documentation provided. -
EXTERNAL CONSTANT DARK-OLIVE-GREEN
No documentation provided. -
EXTERNAL CONSTANT DARK-ORANGE
No documentation provided. -
EXTERNAL CONSTANT DARK-ORCHID
No documentation provided. -
EXTERNAL CONSTANT DARK-RED
No documentation provided. -
EXTERNAL CONSTANT DARK-SALMON
No documentation provided. -
EXTERNAL CONSTANT DARK-SEA-GREEN
No documentation provided. -
EXTERNAL CONSTANT DARK-SLATE-BLUE
No documentation provided. -
EXTERNAL CONSTANT DARK-SLATE-GRAY
No documentation provided. -
EXTERNAL CONSTANT DARK-TURQUOISE
No documentation provided. -
EXTERNAL CONSTANT DARK-VIOLET
No documentation provided. -
EXTERNAL CONSTANT DEEP-PINK
No documentation provided. -
EXTERNAL CONSTANT DEEP-SKY-BLUE
No documentation provided. -
EXTERNAL CONSTANT DIM-GRAY
No documentation provided. -
EXTERNAL CONSTANT DODGER-BLUE
No documentation provided. -
EXTERNAL CONSTANT FIREBRICK
No documentation provided. -
EXTERNAL CONSTANT FLORAL-WHITE
No documentation provided. -
EXTERNAL CONSTANT FOREST-GREEN
No documentation provided. -
EXTERNAL CONSTANT GAINSBORO
No documentation provided. -
EXTERNAL CONSTANT GHOST-WHITE
No documentation provided. -
EXTERNAL CONSTANT GOLD
No documentation provided. -
EXTERNAL CONSTANT GOLDEN-ROD
No documentation provided. -
EXTERNAL CONSTANT GRAY
No documentation provided. -
EXTERNAL CONSTANT GREEN
No documentation provided. -
EXTERNAL CONSTANT GREEN-YELLOW
No documentation provided. -
EXTERNAL CONSTANT HONEYDEW
No documentation provided. -
EXTERNAL CONSTANT HOT-PINK
No documentation provided. -
EXTERNAL CONSTANT INDIAN-RED
No documentation provided. -
EXTERNAL CONSTANT INDIGO
No documentation provided. -
EXTERNAL CONSTANT IVORY
No documentation provided. -
EXTERNAL CONSTANT KHAKI
No documentation provided. -
EXTERNAL CONSTANT LAVENDER
No documentation provided. -
EXTERNAL CONSTANT LAVENDER-BLUSH
No documentation provided. -
EXTERNAL CONSTANT LAWN-GREEN
No documentation provided. -
EXTERNAL CONSTANT LEMON-CHIFFON
No documentation provided. -
EXTERNAL CONSTANT LIGHT-BLUE
No documentation provided. -
EXTERNAL CONSTANT LIGHT-CORAL
No documentation provided. -
EXTERNAL CONSTANT LIGHT-CYAN
No documentation provided. -
EXTERNAL CONSTANT LIGHT-GOLDEN-ROD-YELLOW
No documentation provided. -
EXTERNAL CONSTANT LIGHT-GRAY
No documentation provided. -
EXTERNAL CONSTANT LIGHT-GREEN
No documentation provided. -
EXTERNAL CONSTANT LIGHT-PINK
No documentation provided. -
EXTERNAL CONSTANT LIGHT-SALMON
No documentation provided. -
EXTERNAL CONSTANT LIGHT-SEA-GREEN
No documentation provided. -
EXTERNAL CONSTANT LIGHT-SKY-BLUE
No documentation provided. -
EXTERNAL CONSTANT LIGHT-SLATE-GRAY
No documentation provided. -
EXTERNAL CONSTANT LIGHT-STEEL-BLUE
No documentation provided. -
EXTERNAL CONSTANT LIGHT-YELLOW
No documentation provided. -
EXTERNAL CONSTANT LIME
No documentation provided. -
EXTERNAL CONSTANT LIME-GREEN
No documentation provided. -
EXTERNAL CONSTANT LINEN
No documentation provided. -
EXTERNAL CONSTANT MAGENTA
No documentation provided. -
EXTERNAL CONSTANT MAROON
No documentation provided. -
EXTERNAL CONSTANT MEDIUM-AQUA-MARINE
No documentation provided. -
EXTERNAL CONSTANT MEDIUM-BLUE
No documentation provided. -
EXTERNAL CONSTANT MEDIUM-ORCHID
No documentation provided. -
EXTERNAL CONSTANT MEDIUM-PURPLE
No documentation provided. -
EXTERNAL CONSTANT MEDIUM-SEA-GREEN
No documentation provided. -
EXTERNAL CONSTANT MEDIUM-SLATE-BLUE
No documentation provided. -
EXTERNAL CONSTANT MEDIUM-SPRING-GREEN
No documentation provided. -
EXTERNAL CONSTANT MEDIUM-TURQUOISE
No documentation provided. -
EXTERNAL CONSTANT MEDIUM-VIOLET-RED
No documentation provided. -
EXTERNAL CONSTANT MIDNIGHT-BLUE
No documentation provided. -
EXTERNAL CONSTANT MINT-CREAM
No documentation provided. -
EXTERNAL CONSTANT MISTY-ROSE
No documentation provided. -
EXTERNAL CONSTANT MOCCASIN
No documentation provided. -
EXTERNAL CONSTANT NAVAJO-WHITE
No documentation provided. -
EXTERNAL CONSTANT NAVY
No documentation provided. -
EXTERNAL CONSTANT OLD-LACE
No documentation provided. -
EXTERNAL CONSTANT OLIVE
No documentation provided. -
EXTERNAL CONSTANT OLIVE-DRAB
No documentation provided. -
EXTERNAL CONSTANT ORANGE
No documentation provided. -
EXTERNAL CONSTANT ORANGE-RED
No documentation provided. -
EXTERNAL CONSTANT ORCHID
No documentation provided. -
EXTERNAL CONSTANT PALE-GOLDEN-ROD
No documentation provided. -
EXTERNAL CONSTANT PALE-GREEN
No documentation provided. -
EXTERNAL CONSTANT PALE-TURQUOISE
No documentation provided. -
EXTERNAL CONSTANT PALE-VIOLET-RED
No documentation provided. -
EXTERNAL CONSTANT PAPAYA-WHIP
No documentation provided. -
EXTERNAL CONSTANT PEACH-PUFF
No documentation provided. -
EXTERNAL CONSTANT PERU
No documentation provided. -
EXTERNAL CONSTANT PINK
No documentation provided. -
EXTERNAL CONSTANT PLUM
No documentation provided. -
EXTERNAL CONSTANT POWDER-BLUE
No documentation provided. -
EXTERNAL CONSTANT PURPLE
No documentation provided. -
EXTERNAL CONSTANT RED
No documentation provided. -
EXTERNAL CONSTANT ROSY-BROWN
No documentation provided. -
EXTERNAL CONSTANT ROYAL-BLUE
No documentation provided. -
EXTERNAL CONSTANT SADDLE-BROWN
No documentation provided. -
EXTERNAL CONSTANT SALMON
No documentation provided. -
EXTERNAL CONSTANT SANDY-BROWN
No documentation provided. -
EXTERNAL CONSTANT SEA-GREEN
No documentation provided. -
EXTERNAL CONSTANT SEA-SHELL
No documentation provided. -
EXTERNAL CONSTANT SIENNA
No documentation provided. -
EXTERNAL CONSTANT SILVER
No documentation provided. -
EXTERNAL CONSTANT SKY-BLUE
No documentation provided. -
EXTERNAL CONSTANT SLATE-BLUE
No documentation provided. -
EXTERNAL CONSTANT SLATE-GRAY
No documentation provided. -
EXTERNAL CONSTANT SNOW
No documentation provided. -
EXTERNAL CONSTANT SPRING-GREEN
No documentation provided. -
EXTERNAL CONSTANT STEEL-BLUE
No documentation provided. -
EXTERNAL CONSTANT TAN
No documentation provided. -
EXTERNAL CONSTANT TEAL
No documentation provided. -
EXTERNAL CONSTANT THISTLE
No documentation provided. -
EXTERNAL CONSTANT TOMATO
No documentation provided. -
EXTERNAL CONSTANT TRANSPARENT
No documentation provided. -
EXTERNAL CONSTANT TURQUOISE
No documentation provided. -
EXTERNAL CONSTANT VIOLET
No documentation provided. -
EXTERNAL CONSTANT WHEAT
No documentation provided. -
EXTERNAL CONSTANT WHITE
No documentation provided. -
EXTERNAL CONSTANT WHITE-SMOKE
No documentation provided. -
EXTERNAL CONSTANT YELLOW
No documentation provided. -
EXTERNAL CONSTANT YELLOW-GREEN
No documentation provided.
-