Color.initByColor

Syntax

initByColor(color)

Parameters

color. Color, instance of PP.Color.

Description

The initByColor method applies the color specified in parameters to the current one.

Example

To execute the example, open any page with the connected PP.js. script. Create two new colors and copy one to another:

// Create a new color
c1 = new PP.Color;
// Set color
c1.setR(200);
c1.setG(230);
c1.setB(150);
// Create the second color
c2 = new PP.Color;
c2.setR(0);
c2.setG(0);
c2.setB(0);
// Apply the first color to the second one
c2.initByColor(c1);
// Get second color value
c2;

After executing the example the c2 color is obtained:

PP.Color {_R: 200, _G: 230, _B: 150, _A: 255, _H: 0…}

See also:

Color