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

color-with-alpha Function

Summary

Adds a specified alpha component to a color.

Package

color

Signature

color-with-alpha color alpha => color-spec

Arguments
color
A color specification.
alpha
A real in the inclusive range [0,1].
Values
color-spec
A color specification, or nil.
Description

The function color-with-alpha returns a color like the argument color but with alpha component alpha.

color needs to be a color specification, either a keyword naming a color (a member of the result of calling get-all-color-names), or a color-spec (for example the result of make-rgb).

alpha must be a real in the inclusive range [0,1], otherwise an error is signaled. alpha = 0 means color-spec is transparent, alpha = 1 means it is solid.

color-with-alpha returns a color-spec, or nil if color is not recognized.

See also

get-all-color-names
make-rgb
15.1 Color specs


CAPI User Guide and Reference Manual (Windows version) - 01 Dec 2021 19:34:21