LamColorUtil
in package
Color calculations
Table of Contents
- adjustBrightness() : string
- Adjusts the brightness of the given hex color (e.g. #123456).
- getTextColor() : string
- Returns the text color that should be used for the given background color.
- parseColor() : LamColor
- Parses a color value.
Methods
adjustBrightness()
Adjusts the brightness of the given hex color (e.g. #123456).
public
static adjustBrightness(string $color, float $percentage) : string
Parameters
- $color : string
-
hex color (e.g. #123456)
- $percentage : float
-
percentage to darken (< 1 darkens, > 1 brightens)
Return values
string —darker color (e.g. #123456)
getTextColor()
Returns the text color that should be used for the given background color.
public
static getTextColor(string $backgroundColor) : string
Parameters
- $backgroundColor : string
-
background color (e.g. #123456)
Return values
string —text color (e.g. #000000)
parseColor()
Parses a color value.
public
static parseColor(string $color) : LamColor
Parameters
- $color : string
-
color
Return values
LamColor —color