Previous: , Up: Colors   [Contents][Index]


4.10.2 Changing color definitions

Most terminals don’t support defining new colors or changing the colors that already exist. For those terminals that do, the function init-color! can be used to change the definition of colors by adjusting the amount of red, green, and blue in each. To set the red to a darker red, you could use this function

;; Param 1: color name
;; Param 2, 3, 4; RGB content, min=0 max=1000
(init-color! COLOR_RED 300 0 0)

If your terminal cannot change the color definitions, the procedure will throw and error. The function can-change-color? can be used to find out whether that terminal has the capability of changing color content or not. The RGB content is scaled from 0 to 1000. Initially, red is likely defined with content 680 (r), 0 (g), 0 (b).

The functions color-content and pair-content can be used to find the color content of a given color and foreground/background combination of a color pair.