HumHub Documentation (unofficial)

RGB
in package
implements ColorInterface

FinalYes

Table of Contents

Interfaces

ColorInterface

Properties

$alpha  : int
$b  : int
$g  : int
$palette  : RGB
$r  : int

Methods

__construct()  : mixed
__toString()  : string
Returns hex representation of the color.
darken()  : static
Returns a copy of the current color, darkened by the specified number of shades.
dissolve()  : static
Returns a copy of current color, incrementing the alpha channel by the given amount.
getAlpha()  : int|null
Returns percentage of transparency of the color (from 0 - fully transparent, to 100 - fully opaque).
getBlue()  : int
Returns BLUE value of the color (from 0 to 255).
getGreen()  : int
Returns GREEN value of the color (from 0 to 255).
getPalette()  : PaletteInterface
Returns the palette attached to the current color.
getRed()  : int
Returns RED value of the color (from 0 to 255).
getValue()  : int|null
Return the value of one of the component.
grayscale()  : static
Returns a gray related to the current color.
isOpaque()  : bool
Checks if the current color is opaque.
lighten()  : static
Returns a copy of the current color, lightened by the specified number of shades.
setAlpha()  : mixed
Internal.
setColor()  : mixed
Internal.

Properties

$alpha

private int $alpha

Methods

__construct()

public __construct(RGB $palette, array<string|int, int> $color, int $alpha) : mixed
Parameters
$palette : RGB
$color : array<string|int, int>
$alpha : int

darken()

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

public darken(mixed $shade) : static
Parameters
$shade : mixed
Tags
see
ColorInterface::darken()
Return values
static

dissolve()

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

public dissolve(mixed $alpha) : static
Parameters
$alpha : mixed
Tags
see
ColorInterface::dissolve()
Return values
static

getAlpha()

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

public getAlpha() : int|null
Tags
see
ColorInterface::getAlpha()
Return values
int|null

return NULL if the color type does not support transparency

getBlue()

Returns BLUE value of the color (from 0 to 255).

public getBlue() : int
Return values
int

getGreen()

Returns GREEN value of the color (from 0 to 255).

public getGreen() : int
Return values
int

getRed()

Returns RED value of the color (from 0 to 255).

public getRed() : int
Return values
int

getValue()

Return the value of one of the component.

public getValue(mixed $component) : int|null
Parameters
$component : mixed

One of the ColorInterface::COLOR_* component

Tags
see
ColorInterface::getValue()
Return values
int|null

lighten()

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

public lighten(mixed $shade) : static
Parameters
$shade : mixed
Tags
see
ColorInterface::lighten()
Return values
static

setAlpha()

Internal.

private setAlpha(int $alpha) : mixed

Performs checks for validity of given alpha value and sets it

Parameters
$alpha : int
Tags
throws
InvalidArgumentException

setColor()

Internal.

private setColor(array<string|int, mixed> $color) : mixed

Performs checks for color validity (array of array(R, G, B))

Parameters
$color : array<string|int, mixed>
Tags
throws
InvalidArgumentException

        
On this page

Search results