User Tools

Site Tools


Sidebar

Passage markup

basics

coding

extra

list

section

whitespace

Macros

basics

colour

data structure

date and time

game state

live

maths

number

revision

saving

showing and hiding

string

styling

url

deprecated

Types of data

Special keywords

Special passage tags

harlowe:rgb

(rgb: Number, Number, Number) → colour

This macro creates a colour using the three red ®, green (g) and blue (b) values provided, whose values are whole number between 0 and 255.

Example usage:

  • (rgb: 255, 0, 47) produces a colour with 255 red, 0 blue and 47 green.
  • (rgb: 90, 0, 0)'s r produces the number 90.

Rationale:

The RGB additive colour model is commonly used for defining colours: the HTML hexadecimal notation for colours (such as #9263AA) simply consists of three hexadecimal values placed together. This macro allows you to create such colours computationally, by providing variables for certain components.

Details:

This macro takes the same range of numbers as the CSS rgb() function.

Giving values higher than 255 or lower than 0, or with a fractional part, will cause an error.

See also:

harlowe/rgb.txt · Last modified: 2017/06/18 21:59 by l