A numeric value corresponding to the alpha channel
A valid alpha channel value in range [0, 1]
Given a hue (value
) - ensure that it is in range [0, 359]
The value that needs to be rounded
A positively bounded hue value
Restricts the value of val
to be between min
and max
for number inputs
Lower bound (0)
Current value
Upper bound (typically 100, 255, 359)
A number in the range [min, max]
such that min <= val <= max
Transforms an input RGBA string into an RGBA ([r, g, b, a]) numeric array
Input RGBA string from which the RGB values are extracted
If the string is not RGBA, this array is returned instead
An RGBA array based on the input string in the form [r, g, b, a]
Helper for generating random numbers (integer) from an upper bounded range
Output will be bounded to [0, max]
A positive integer that is randomly generated and guaranteed to be less than max
Given a value, rounds the value to a given precision (number of decimal places)
The value that needs to be rounded
How many decimal places to include in the result
The input value with "precision" amount of decimal places
Converts a RGB color space channel value into its corresponding standard RGB (sRGB) color space value
The RGB channel value to convert
standard RGB equivalent of the RGB channel value provided
Inverse of sRGB - converts sRGB to RGB color space value
The sRGB channel value to convert
RGB equivalent of the standard RGB channel value provided
Helper function to correctly determine or clamp the alpha channel value
This utility function is provided to provide identical logic for alpha channel value determination. Unlike other channels, the alpha channel is optional, thus it needs to be handled differently.