[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/vendor/splitbrain/lesserphp/src/Utils/ -> Color.php (summary)

(no description)

File Size: 187 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Color:: (6 methods):
  coerceColor()
  toLuma()
  toHSL()
  toRGB()
  fixColor()
  calculateRGBComponent()


Class: Color  - X-Ref

Color handling utilities

coerceColor(array $value)   X-Ref
coerce a value for use in color operation
returns null if the value can't be used in color operations


toLuma(array $color)   X-Ref
Calculate the perceptual brightness of a color object


toHSL(array $color)   X-Ref
Convert a color to HSL color space


toRGB(array $color)   X-Ref
Converts a hsl array into a color value in rgb.
Expects H to be in range of 0 to 360, S and L in 0 to 100


fixColor(array $c)   X-Ref
make sure a color's components don't go out of bounds


calculateRGBComponent(float $comp, float $temp1, float $temp2)   X-Ref
Helper function for the HSL to RGB conversion process.

This function normalizes the input component of the HSL color and determines the RGB
value based on the HSL values.

return: float The calculated RGB value as percentage of the maximum value (255)
param: float $comp The component of the HSL color to be normalized and converted.
param: float $temp1 The first temporary variable used in the conversion process
param: float $temp2 The second temporary variable used in the conversion process