Color Class Reference

The JavaScript class for manipulating colours. Can be created from a Palette object. More...

Public Slots

void setColorType (String &colorType)
 
void setColorType (int t)
 
void setColorData (QVariant v)
 Set the rgba or gradient values of the colour. More...
 
- Public Slots inherited from BaseColor
void setName (String &n)
 

Properties

int colorType
 The type of colour can be: ColorType.SOLID_COLOR, ColorType.LINEAR_GRADIENT or ColorType.RADIAL_GRADIENT. More...
 
QVariant colorData
 The colour as either an object if the colour is solid or an array of objects if it is a gradient. More...
 
- Properties inherited from BaseColor
bool isTexture
 If true, the color pot is a texture. More...
 
String name
 The color pot name. More...
 
String id
 Unique ID of the color. More...
 
bool isValid
 Returns true if the color is valid. More...
 

Detailed Description

The JavaScript class for manipulating colours. Can be created from a Palette object.

var myColor = palette.createNewSolidColor("myColorName", ColorRGBA(120, 120, 120, 120);

A Color object can be a solid colour, a linear gradient or a radial gradient.

Member Function Documentation

◆ setColorData

void Color::setColorData ( QVariant  v)
slot

Set the rgba or gradient values of the colour.

if(paletteList.numPalettes < 1)
return;
var myPalette = paletteList.getPaletteByIndex(0);
if(myPalette.nColors < 1)
return;
var myColor = myPalette.getColorByIndex(0);
myColor.setColorData({r : 255, g : 0, b: 0, a : 255});
Parameters
vIs either an object for solid colours or an array of objects for gradients

◆ setColorType [1/2]

void Color::setColorType ( String &  colorType)
slot
Parameters
colorTypeOne of the ColorType, ex: "SOLID_COLOR", "LINEAR_GRADIENT" or "RADIAL_GRADIENT"

◆ setColorType [2/2]

void Color::setColorType ( int  t)
slot
Parameters
tA constant from the ColorType class.

Property Documentation

◆ colorData

QVariant Color::colorData
read

The colour as either an object if the colour is solid or an array of objects if it is a gradient.

For example: The solid colour red:

{ r : 255, g : 0, b: 0, a : 255 }

The gradient colour going from red to green:

[{ r : 255, g : 0, b: 0, a : 255, t: 0 }, {r : 0, g : 255, b: 0, a : 255, t: 1 }]

◆ colorType

int Color::colorType
read