color - Ren'Py Visual Novel Engine

documentation index ◦ reference manual ◦ function index

# color

Function: | color | (s):

This function converts hexcode string s into a color/alpha tuple. Leading # marks are ignored. Colors can be rgb or rgba, with each element having either one or two digits. (So the strings can be 3, 4, 6, or 8 digits long, not including the optional #.) A missing alpha is interpreted as 255, fully opaque.

For example, color('#123a') returns (17, 34, 51, 170), while color('c0c0c0') returns (192, 192, 192, 255).

Note that as of Ren'Py 5.6.0, functions requiring a color accept the hex string form of specification directly, with no need to use this color function.

## Example

    init:
        image PaleVioletRed = Solid(color("#DB7093"))

documentation index ◦ reference manual ◦ function index