ensure-
<command>

Function

Summary

Return a color specification for a given model. The model depends on the particular function called

Package

color

Signature

ensure-rgb color-spec
=> result

ensure-hsv color-spec
=> result

ensure-gray color-spec
=> result

ensure-model-color color-spec model
=> result

ensure-color color-spec match-color-spec
=> result

Arguments

For all functions:

color-spec

A color specification.

match-color-spec

A color specification.

model

A color-model (
:rgb
,
:hsv
or
:gray
).

Values

result

A color specification.

Description

These functions all return a color specification, given (at least) a color specification as argument.

ensure-rgb
,
ensure-hsv
and
ensure-gray
all return a color specification 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.

ensure-model-color
is similar to the above three functions, except that a color-model
model
is explicitly passed as an argument to the function. The color-spec returned is in the color-model specified by
model
.

ensure-color
returns a color specification for
color-spec
, in the color model specified by
match-color-spec
. Thus, color specifications may be converted from one model to another with having to explicitly state the color model.