Stud.IP  5.4
Color Class Reference

Static Public Member Functions

static static hex2array ($color)
 
static rgba2array ($color)
 
static rgb2array ($color)
 
static hsl2array ($color)
 
static mix ($color1, $color2, $percentOfColor1=50, $f=null)
 
static opacity ($color, $opacity)
 
static brighten ($color, $factor=35)
 
static rgba ($color)
 
static rgb ($color)
 
static hex ($color)
 
static hsl ($color)
 
static hsla ($color)
 

Static Public Attributes

static $colorstrings
 

Detailed Description

class to mix colors and convert them between different types

Since
2.1

Member Function Documentation

◆ brighten()

static brighten (   $color,
  $factor = 35 
)
static

Make the passed color brighter

Author
Till Glöggler tgloe.nosp@m.ggl@.nosp@m.uos.d.nosp@m.e
Parameters
string$colorany type of css-valid color
int$factorpercentage of brightning, 100 for white and 0 for no changes to color
Returns
string brightened color in same format as the passed one

◆ hex()

static hex (   $color)
static

converts a css-hex-color into a rgba-quadruple

Parameters
string$colorthe color to be converted
Returns
array colors as rgba-quadruple

◆ hex2array()

static static hex2array (   $color)
static

converts a css-hex-color into a rgba-quadruple

Parameters
string$colorthe color to be converted
Returns
array colors as rgba-quadruple

◆ hsl()

static hsl (   $color)
static

converts a css-hsl-color into a rgba-quadruple

Parameters
string$colorthe color to be converted
Returns
array colors as rgba-quadruple

◆ hsl2array()

static hsl2array (   $color)
static

converts a css-hsl-color into a rgba-quadruple

Parameters
string$colorthe color to be converted
Returns
array colors as rgba-quadruple

◆ hsla()

static hsla (   $color)
static

converts a css-hsla-color into a rgba-quadruple

Parameters
string$colorthe color to be converted
Returns
array colors as rgba-quadruple

◆ mix()

static mix (   $color1,
  $color2,
  $percentOfColor1 = 50,
  $f = null 
)
static

Mixes two colors by preferring the first one with $percentOfColor1 percent. If color2 is the only color with alpha-chanel, it will return a color in the format of color2 else (most of the time) in the format of color1.

Returns
string: "#ffffff", "rgb(...)", "rgba(...)" depending on color1 and alpha-chanel

◆ opacity()

static opacity (   $color,
  $opacity 
)
static

Sets the opacity for a color. Hue and saturation is kept, but opacity is changed. Returns a format with alpha-chanel (rgba or hsla) depending on the given format.

◆ rgb()

static rgb (   $color)
static

converts a css-rgb-color into a rgba-quadruple

Parameters
string$colorthe color to be converted
Returns
array colors as rgba-quadruple

◆ rgb2array()

static rgb2array (   $color)
static

converts a css-rgb-color into a rgba-quadruple

Parameters
string$colorthe color to be converted
Returns
array colors as rgba-quadruple

◆ rgba()

static rgba (   $color)
static

converts a css-rgba-color into a rgba-quadruple

Parameters
string$colorthe color to be converted
Returns
array colors as rgba-quadruple

◆ rgba2array()

static rgba2array (   $color)
static

converts a css-rgba-color into a rgba-quadruple

Parameters
string$colorthe color to be converted
Returns
array colors as rgba-quadruple

Field Documentation

◆ $colorstrings

$colorstrings
static
Initial value:
= [
'aqua' => [0, 255, 255, 1]

The documentation for this class was generated from the following file: