All Manuals > CAPI User Guide and Reference Manual > 24 COLOR Reference Entries

ensure-rgb

ensure-hsv

ensure-gray Functions

Summary

Returns a color specification for a particular model.

Package

color

Signatures

ensure-rgb color-spec => result

ensure-hsv color-spec => result

ensure-gray color-spec => result

Arguments
color-spec
A color specification.
Values
result
A color specification.
Description

The functions ensure-rgb, ensure-hsv and ensure-gray each return a color specification matching the supplied color-spec, but in the appropriate model.

If color-spec is in the same model, it is just returned. Otherwise a new color specification for that model is calculated. Thus, ensure-rgb returns a color specification in the RGB color model, whatever color model is used in color-spec.

If color-spec has an alpha component, then result has that same alpha component.

Examples
(ensure-hsv (make-rgb 1 1 0 0.75))
=>
#(:HSV 1 1 1 0.75)
(ensure-gray (make-rgb 0 0 1 0.75))
=>
#(:GRAY 0.33333302S0 0.75)
See also

convert-color
colors=
ensure-color
ensure-model-color
15.3 Color models


CAPI User Guide and Reference Manual (Unix version) - 01 Dec 2021 19:33:10