Nextcloud PHP API (master)

Color
in package

Simple RGB color container

Tags
since
25.0.0

Table of Contents

Properties

$b  : int
$g  : int
$r  : int

Methods

__construct()  : mixed
alphaBlending()  : Color
Alpha blend another color with a given opacity to this color
blue()  : int
Returns the green blue component of this color as an int from 0 to 255
blueF()  : float
Returns the blue color component of this color as a float from 0 to 1
green()  : int
Returns the green color component of this color as an int from 0 to 255
greenF()  : float
Returns the green color component of this color as a float from 0 to 1
mixPalette()  : array<int, Color>
Mix two colors
name()  : string
Returns the name of the color in the format "#RRGGBB"; i.e. a "#" character followed by three two-digit hexadecimal numbers.
red()  : int
Returns the red color component of this color as an int from 0 to 255
redF()  : float
Returns the red color component of this color as a float from 0 to 1
stepCalc()  : array{0: int, 1: int, 2: int}
Calculate steps between two Colors

Properties

Methods

__construct()

public __construct(mixed $r, mixed $g, mixed $b) : mixed
Parameters
$r : mixed
$g : mixed
$b : mixed
Tags
since
25.0.0

alphaBlending()

Alpha blend another color with a given opacity to this color

public alphaBlending(float $opacity, Color $source) : Color
Parameters
$opacity : float
$source : Color
Tags
since
25.0.0
Return values
Color

The new color

blue()

Returns the green blue component of this color as an int from 0 to 255

public blue() : int
Tags
since
25.0.0
Return values
int

blueF()

Returns the blue color component of this color as a float from 0 to 1

public blueF() : float
Tags
since
25.0.0
Return values
float

green()

Returns the green color component of this color as an int from 0 to 255

public green() : int
Tags
since
25.0.0
Return values
int

greenF()

Returns the green color component of this color as a float from 0 to 1

public greenF() : float
Tags
since
25.0.0
Return values
float

mixPalette()

Mix two colors

public static mixPalette(int $steps, Color $color1, Color $color2) : array<int, Color>
Parameters
$steps : int

the number of intermediate colors that should be generated for the palette

$color1 : Color

the first color

$color2 : Color

the second color

Tags
since
25.0.0
Return values
array<int, Color>

name()

Returns the name of the color in the format "#RRGGBB"; i.e. a "#" character followed by three two-digit hexadecimal numbers.

public name() : string
Tags
since
25.0.0
Return values
string

red()

Returns the red color component of this color as an int from 0 to 255

public red() : int
Tags
since
25.0.0
Return values
int

redF()

Returns the red color component of this color as a float from 0 to 1

public redF() : float
Tags
since
25.0.0
Return values
float

stepCalc()

Calculate steps between two Colors

private static stepCalc(int $steps, array<string|int, Color$ends) : array{0: int, 1: int, 2: int}
Parameters
$steps : int

start color

$ends : array<string|int, Color>

end color

Tags
since
25.0.0
Return values
array{0: int, 1: int, 2: int}

[r,g,b] steps for each color to go from $steps to $ends


        
On this page

Search results