returns string of color in hex format (can be changed, see chapter 5.3)
on error returns empty string (to display errors list, enable debugging, see chapter 5.6)
Parameter
Description
$input
Input you are basing the coloring around, eg.: user id or user name. Integers, numbers with decimal points and strings (case sensitive) are accepted
$opacity (optional)
CSS opacity value, only used if color type is set to "rgba". Accepted values are numbers in <0;1> range. Default value is set to 1
5.2 setColorPickingMethod($colorPickingMethod)
Specifies what color picking method will be used when getColor() is called
This setting is optional, if you won't call this function, default value will be used
$colorPickingMethod
Description
"static" (default)
Colors are assigned from pregenerated colors list. The same color will always be assigned to certain input across instances of PHPAutoColor
"dynamic"
Colors are assigned gradually from pregenerated colors list (first color will always be black, second one white...)
"dynamic-random"
Colors are assigned randomly from pregenerated colors list
"random"
Colors are assigned randomly
5.3 setColorType($colorType)
Specifies in what format the color will be returned after calling getColor()
This setting is optional, if you won't call this function, default value will be used
$colorType
Description
"hex" (default)
Color in hexadecimal format will be returned. If possible, color will be shortened to 3 digit format. (eg.: #968AE8, #FFF)
"rgb"
Color in rgb format (eg.: rgb(255,255,255))
"rgba"
Color in rgba format (eg.: rgba(255,255,255,0.5))
5.4 setLightnessLimit($type, $lightness)
Limits the maximum or minimum perceived lightness of colors which will be returned after calling getColor(). For example, you have white background so you don't want getColor() to return white and other very bright colors, so you use setLightnessLimit("max", 0.8)
setLightnessLimit() can be called twice if you want to set "max" and "min" limit at the same time (difference between maximum and minimum lightness must be bigger or equal to 0.2)
This setting is optional, if you won't call this function, default value will be used
$type
$lightness default
Accepted values
Description
"max"
1
<0.2;1>
Limits maximum perceived lightness of returned colors
"min"
0
<0;0.8>
Limits minimum perceived lightness of returned colors
5.5 setMaximumColors($maximumColors)
Limits the maximum number of colors with which the PHPAutoColor will work.
If list of used colors in one instance of PHPAutoColor will hit the $maximumColors limit, we start reusing previously assigned colors
This setting is optional, if you won't call this function, number of used colors won't be limited
$maximumColors accepted values
Description
bigger or equal to 2
Limits the maximum number of used colors
5.6 enableDebugging()
Enables displaying of detected errors
If errors occur, empty string is returned from getColor() method
This setting is optional, if you won't call this function debugging window won't appear
6. List of pregenerated colors
List of 65 visually most distinct colors generated using CIEDE2000 algorithm
Colors from this list are used if you use setColorPickingMethod() with "static" (default), "dynamic" or "dynamic-random" parameter