Color Commands

Description

The color commands set the current color for all subsequent UI elements. OSL provides three equivalent commands for setting colors: colour, color, and c. All three commands function identically, allowing you to use whichever spelling you prefer.

Syntax

colour #hexcode
color #hexcode
c #hexcode

// Or using RGB integer (0-16777215)
colour integer
color integer
c integer

Parameters

  • #hexcode: A hexadecimal color code (e.g., #3498db) or single-value RGB color

  • integer: A number between 0 and 16777215 representing RGB color (e.g., 13434829 for #CD1234)

Usage Examples

Important Notes

  • The color remains active until changed by another color command

  • Supports both hex codes and RGB integers:

    • Hex: #RRGGBB or #RGB format

    • Integer: 0-16777215 (represents full RGB color space)

  • Color affects all subsequent drawing operations

  • The three command variations (colour, color, c) are completely interchangeable

  • Hex colors are case-insensitive (#FFF is the same as #fff)

  • Invalid color codes or integers outside the valid range will default to black (#000000)

  • The default color is white (#FFFFFF or 16777215) if no color is set

Last updated

Was this helpful?