CSSkinWrapper
in package
Abstract class to serve as a base structure for multiple CSSkin's classes
Tags
Table of Contents
- LOGO_TYPE_LARGE = 0
- Logo types
- LOGO_TYPE_SMALL = 1
- addTransparencyToHexColor() : string
- Adds the transparency part of the hex color based on a percentage. It will also overwrite already defined alpha channel in the color code.
- createCSSFiles() : mixed
- Creates all CSS files required
- getApplicationLogoForType() : string
- Returns the URL to the configured or standard application SVG logo.
- getColor() : mixed|null
- Get a specific color based in a given token
- getColors() : array<string|int, mixed>
- Get all the colors defined
- getHexColorFromBrightness() : string
- Calculates a new hex color based on a level of brightness
- getLuminance() : float
- This algorithm is taken from a formula for converting RGB values to YIQ values.
- getOptionNames() : string
- Tells which option names are available
- getParam() : string
- Returns a specific parameter value by name
- getParamNames() : array<string|int, mixed>
- Returns which parameter names are available
- getStandardLuminance() : float
- Calculates the relative luminance which is the Standard way to calculate luminance
- getStylesheetLink() : string
- isBrightColor() : bool
- Tells if a color is bright against a dark background
- isDarkColor() : bool
- Tells if a color is dark against a white background
- parseColorParameter() : mixed|null
Constants
LOGO_TYPE_LARGE
Logo types
public
int
LOGO_TYPE_LARGE
= 0
Tags
LOGO_TYPE_SMALL
public
mixed
LOGO_TYPE_SMALL
= 1
Tags
Methods
addTransparencyToHexColor()
Adds the transparency part of the hex color based on a percentage. It will also overwrite already defined alpha channel in the color code.
public
static addTransparencyToHexColor(string $sHexColor, float $fPercent) : string
Parameters
- $sHexColor : string
-
the hex code color definition
- $fPercent : float
-
the percentage of transparency to add to the color, if negative makes it darker, if positive makes it brighter, value between 0 and 1
Tags
Return values
string —the 8 digit hex color, being the last 2 digits the alpha channel
createCSSFiles()
Creates all CSS files required
public
static createCSSFiles(int $iThemeId) : mixed
Parameters
- $iThemeId : int
Tags
Return values
mixed —getApplicationLogoForType()
Returns the URL to the configured or standard application SVG logo.
public
static getApplicationLogoForType([int $iType = self::LOGO_TYPE_LARGE ][, string $sBackgroundColor = '' ]) : string
If a HEX background color is given the standard application SVG logo will be returned with a contrast color.
Parameters
- $iType : int = self::LOGO_TYPE_LARGE
-
The size type of the application logo. Please use the available logo type constants: LOGO_TYPE_*
- $sBackgroundColor : string = ''
-
The HEX background color to return the logo with the most contrast for the given background color.
Tags
Return values
string —getColor()
Get a specific color based in a given token
public
final static getColor(mixed $sToken[, mixed $sDefault = '' ]) : mixed|null
Parameters
- $sToken : mixed
-
string The token corresponding the color to be retrieved
- $sDefault : mixed = ''
-
string The color to default to
Tags
Return values
mixed|null —getColors()
Get all the colors defined
public
final static getColors() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getHexColorFromBrightness()
Calculates a new hex color based on a level of brightness
public
static getHexColorFromBrightness(string $sHexColor, float $fPercent) : string
Parameters
- $sHexColor : string
-
the hex code color definition
- $fPercent : float
-
the percentage of brightness to change the color, if negative makes it darker, if positive makes it brighter, value between 1 and -1
Tags
Return values
string —the calculated hex color
getLuminance()
This algorithm is taken from a formula for converting RGB values to YIQ values.
public
static getLuminance(string $sHexColor) : float
This gives a perceived luminance for a color.
Parameters
- $sHexColor : string
-
$sHexColor the color as 6/8 character hex code color definition, transparency is supported.
Tags
Return values
float —the perceived luminance
getOptionNames()
Tells which option names are available
public
abstract static getOptionNames() : string
Tags
Return values
string —getParam()
Returns a specific parameter value by name
public
final static getParam(string $sName) : string
Parameters
- $sName : string
-
The name of the parameter to request
Tags
Return values
string —The value from the requested parameter
getParamNames()
Returns which parameter names are available
public
final static getParamNames() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —An array with the parameter names available
getStandardLuminance()
Calculates the relative luminance which is the Standard way to calculate luminance
public
static getStandardLuminance(string $sHexColor) : float
Parameters
- $sHexColor : string
-
$sHexColor the color as a 6/8 character hex code color definition, transparency is supported.
Tags
Return values
float —relative luminance
getStylesheetLink()
public
static getStylesheetLink() : string
Tags
Return values
string —returns a style sheet holding all Skin params
isBrightColor()
Tells if a color is bright against a dark background
public
static isBrightColor(string $sHexColor) : bool
Parameters
- $sHexColor : string
-
the color as 6 character hex code color definition, optional with leading #
Tags
Return values
bool —true if bright
isDarkColor()
Tells if a color is dark against a white background
public
static isDarkColor(string $sHexColor) : bool
Parameters
- $sHexColor : string
-
the color as 6 character hex code color definition, optional with leading #
Tags
Return values
bool —true if dark
parseColorParameter()
public
static parseColorParameter(mixed $sColor) : mixed|null
Parameters
- $sColor : mixed
-
string The color to retrieve
