Lets you define an alias for a color specification or alias.
color
define-color-alias name color &optional if-exists => name
| name⇩ |
The name of the new alias. |
| color⇩ |
A color specification for the new alias. |
| if-exists⇩ |
One of :replace, :error or :ignore. |
| name |
The name of the new alias. |
The function define-color-alias defines name to be a color alias for color, which may be another color alias or a color spec.
When color is a color spec rather than another color name, the entry is better described as a "color translation" rather than a "color alias". In particular, calling get-color-alias-translation on name will just return name. get-color-spec with name will return color.
if-exists controls what happens in name is already a known alias:
:replace |
Replace any existing alias. |
:error |
Raise an error if alias is already defined. |
:ignore |
Ignore redefinition of an alias. |
if-exists defaulrs to :replace.
CL-USER 16 > (color:define-color-alias :mygray :darkslategray)
:mygray
CL-USER 17 > (color:define-color-alias :mygray :darkslategray
:error)
Error: :MYGRAY names an existing alias for #(:RGB 0.1843133S0 0.309803S0 0.309803S0)
1 (continue) Replace :MYGRAY with the alias :DARKSLATEGRAY
2 Continue, without redefining alias :MYGRAY
3 Try a new name for the alias, instead of :MYGRAY
4 (abort) Return to level 0.
5 Return to top loop level 0.
6 Destroy process.
Type :c followed by a number to proceed or type :? for other options
CL-USER 18 : 1 >
CL-USER 19 > (color:define-color-alias :lispworks-blue
(color:make-rgb 0.70s0 0.90s0 0.99s0))
:lispworks-blue
CL-USER 20 >
get-color-alias-translation
get-color-spec
15 The Color System
CAPI User Guide and Reference Manual (Windows version) - 01 Dec 2021 19:34:21