ColorParserInterface

Parses a color string into a color model.

Namespace: Com\Tecnick\Color

File: ColorParserInterface.php line 38

Parses a color string into a color model.

Implemented by Web.

Tags

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

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

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