TouchOSC

Next generation modular control surface
TouchOSC Manual

Script · Objects · Color


A color object native to TouchOSC. Will be returned and can be passed anywhere a color is required. Color components are stored as floating point values ranging from 0.0 to 1.0.



Fields

color.r

The red component of the color.

color.g

The green component of the color.

color.b

The blue component of the color.

color.a

The alpha component of the color.

 


Constructor functions

Color()                               -- [1]
Color(color)                          -- [2]
Color(number)                         -- [3]
Color(number, number)                 -- [4]
Color(number, number, number)         -- [5]
Color(number, number, number, number) -- [6]

Returns a new color with

  1. all components initialized with 0.0.
  2. all components copied from another Color object.
  3. all components initialized with number.
  4. rgb components initialized with the first number, the a component initialized with the second number.
  5. rgb components initialized with the three numbers, the a component initialized with 1.0
  6. rgba components initialized with the four numbers provided.

 


Static functions

Color.toHexString(color)

Returns a hexadecimal string representation of the color in the format RRGGBBAA.

Color.fromHexString(string)

Returns a color object created from the hexadecimal string representation. The string can be in one of the following formats: RRGGBBAA, RRGGBB, GGAA, GG, with the latter two forms creating a grayscale color from the GG value.

 


Operators

-- multiplication
color * color
color * number

-- division
color / color
color / number

-- addition
color + color
color + number

-- subtraction
color - color
color - number

All operators operate component-wise and return a new color object.


hexler.net uses cookies to deliver website content. By continuing without changing your preferences, you agree to our use of cookies.