-
Notifications
You must be signed in to change notification settings - Fork 34
classes_base_color.class
Helper class to deal with HTML colors.
Composes a Color object from a valid HTML color string.
Definition: public static function hex($hex_string)
Returns: Color
Parameters:
-
string $hex_string
Valid HTML color string
Returns 'white' or 'black', which ever will be better readable if the given color is a background.
Definition: public static function matchingFont(Color $c, $swapvalue)
Returns: Color Black or White
Parameters:
-
Color $c
The background color -
int $swapvalue
Value when the default 'black' is replaced by 'white' (default: 100)
Composes a random Color.
Definition: public static function random($min=false, $max=false)
Returns: \ScavixWDF\Base\Color
Parameters:
-
mixed $min
Optional string or Color defining the minimum -
mixed $max
Optional string or Color defining the maximum
Composes a ColorRange object.
Definition: public static function range($from, $to)
Returns: \ScavixWDF\Base\Color\ColorRange
Parameters:
-
mixed $from
Optional string or Color defining the start -
mixed $to
Optional string or Color defining the end
Composes a Color object from RGBA values.
Definition: public static function rgba($r, $g, $b, $a)
Returns: \ScavixWDF\Base\Color
Parameters:
-
int $r
Red component (0-255) -
int $g
Green component (0-255) -
int $b
Blue component (0-255) -
float $a
Alpha (0-1)
Sets the alpha value of the color.
Definition: public function setAlpha($a)
Returns: static
Parameters:
-
float|string $a
Alpha value as float (0..1) or string (00..FF)
Represents a color range. Never construct a ColorRange directly, but use Color::range, otherwise the classloader may fail.
Return the color corresponding to percent in the range.
Definition: public function fromPercent($percent)
Returns: \ScavixWDF\Base\Color
Parameters:
-
float|int $percent
The percent (0-100) to get the color for
Return the color corresponding to a value in the range.
Definition: public function fromValue($value)
Returns: \ScavixWDF\Base\Color
Parameters:
-
float|int $value
The value (between min and max) to get the color for
Sets values that act as min and max when querying data.
Definition: public function setMinMax($min, $max)
Returns: ColorRange $this
Parameters:
-
float|int $min
Minimum value -
float|int $max
Maximum value