interface ColorInterface

Constants

COLOR_RED

Channel name: red.

COLOR_GREEN

Channel name: green.

COLOR_BLUE

Channel name: blue.

COLOR_CYAN

Channel name: cyan.

COLOR_MAGENTA

Channel name: magenta.

COLOR_YELLOW

Channel name: yellow.

COLOR_KEYLINE

Channel name: key (black).

COLOR_GRAY

Channel name: gray.

Methods

int|null
getValue(string $component)

Return the value of one of the component.

int|null
getAlpha()

Returns percentage of transparency of the color (from 0 - fully transparent, to 100 - fully opaque).

getPalette()

Returns the palette attached to the current color.

dissolve(int $alpha)

Returns a copy of current color, incrementing the alpha channel by the given amount.

lighten(int $shade)

Returns a copy of the current color, lightened by the specified number of shades.

darken(int $shade)

Returns a copy of the current color, darkened by the specified number of shades.

grayscale()

Returns a gray related to the current color.

bool
isOpaque()

Checks if the current color is opaque.

string
__toString()

Returns hex representation of the color.

Details

at line 81
int|null getValue(string $component)

Return the value of one of the component.

Parameters

string $component One of the ColorInterface::COLOR_* component

Return Value

int|null

Exceptions

InvalidArgumentException if $component is not valid

at line 88
int|null getAlpha()

Returns percentage of transparency of the color (from 0 - fully transparent, to 100 - fully opaque).

Return Value

int|null return NULL if the color type does not support transparency

at line 95
PaletteInterface getPalette()

Returns the palette attached to the current color.

Return Value

PaletteInterface

at line 106
ColorInterface dissolve(int $alpha)

Returns a copy of current color, incrementing the alpha channel by the given amount.

Parameters

int $alpha

Return Value

ColorInterface

Exceptions

RuntimeException if the color type does not support transparency

at line 115
ColorInterface lighten(int $shade)

Returns a copy of the current color, lightened by the specified number of shades.

Parameters

int $shade

Return Value

ColorInterface

at line 124
ColorInterface darken(int $shade)

Returns a copy of the current color, darkened by the specified number of shades.

Parameters

int $shade

Return Value

ColorInterface

at line 131
ColorInterface grayscale()

Returns a gray related to the current color.

Return Value

ColorInterface

at line 138
bool isOpaque()

Checks if the current color is opaque.

Return Value

bool

at line 145
string __toString()

Returns hex representation of the color.

Return Value

string