Table of contents
Namespace: Com\Tecnick\Color
Implements: Template
Abstract: Yes
File: Model.php line 36
Color Model class
Tags
- since: 2015-02-21
- category: Library
- author: Nicola Asuni info@tecnick.com
- copyright: 2015-2026 Nicola Asuni - Tecnick.com LTD
- license: https://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE)
- link: https://github.com/tecnickcom/tc-lib-color
Methods
create()
File: Model.php line 76
public static create(ColorModelType|string $type[, array<string, int|float|string> $components = [] ]) : self
Parameters
- $type : ColorModelType|string: Color model type.
- $components : array<string, int|float|string> = []: Color components.
Tags
- throws: Exception if the type is unknown
- throws: UnknownComponentException if a component name is not defined by the model
Return values
self
getHexValue()
File: Model.php line 401
public getHexValue(float $value, int $max) : string
The result is zero-padded to 2 digits.
Parameters
- $value : float: Fraction value to convert [0..1]
- $max : int: Maximum value to return (reference value) [0..255]
Return values
string
getNormalizedValue()
File: Model.php line 361
public getNormalizedValue(float $value, int $max) : float
Parameters
- $value : float: Fraction value to convert [0..1]
- $max : int: Maximum value to return (reference value)
Return values
float —
value [0..$max]
getRgbaHexColor()
File: Model.php line 409
public getRgbaHexColor() : string
Return values
string
getRgbHexColor()
File: Model.php line 434
public getRgbHexColor() : string
Return values
string
getType()
File: Model.php line 338
public getType() : string
Return values
string
getTypeEnum()
File: Model.php line 348
public getTypeEnum() : ColorModelType
Tags
- throws: Exception if the model declares an unknown type
Return values
withInvertedColor()
File: Model.php line 426
public withInvertedColor() : static
The receiver is left untouched, unlike invertColor().
Return values
static