Table of contents
Namespace: Com\Tecnick\Color
File: ColorParserInterface.php line 38
Parses a color string into a color model.
Implemented by Web.
Tags
- since: 2026-08-26
- 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
getColorObj()
File: ColorParserInterface.php line 47
public getColorObj(string $color) : Model|null
Parameters
- $color : string: String containing web color definition
Tags
- throws: Exception if the color cannot be parsed
Return values
Model|null
getHexFromName()
File: ColorParserInterface.php line 65
public getHexFromName(string $name) : string
Parameters
- $name : string: Name of the color to search (e.g.: ’turquoise')
Tags
- throws: Exception if the color is not found
Return values
string —
color hexadecimal code (e.g.: ‘40e0d0ff’)
getNameFromHex()
File: ColorParserInterface.php line 74
public getNameFromHex(string $hex) : string
Parameters
- $hex : string: hexadecimal color hash (i.e. #RRGGBBAA)
Tags
- throws: Exception if the color is not found
Return values
string
tryGetColorObj()
File: ColorParserInterface.php line 54
public tryGetColorObj(string $color) : Model|null
Parameters
- $color : string: String containing web color definition
Return values
Model|null