DESCRIPTION

FUNCTIONS

mix_2_rgb_colors($rgb1, $rgb2, $pct) => STR

Mix 2 RGB colors. $pct is a number between 0 and 1, by default 0.5 (halfway), the closer to 1 the closer the resulting color to $rgb2.

rand_rgb_color([$low_limit[, $high_limit]]) => STR

Generate a random RGB color. You can specify the limit. Otherwise, they default to the full range (000000 to ffffff).

rgb2grayscale($rgb) => RGB

Convert $rgb to grayscale RGB value.

rgb2sepia($rgb) => RGB

Convert $rgb to sepia tone RGB value.

reverse_rgb_color($rgb) => RGB

Reverse $rgb.

rgb_luminance($rgb) => NUM

Calculate standard/objective luminance from RGB value using this formula:

(0.2126*R) + (0.7152*G) + (0.0722*B)

where R, G, and B range from 0 to 1. Return a number from 0 to 1.

tint_rgb_color($rgb, $tint_rgb, $pct) => RGB

Tint $rgb with $tint_rgb. $pct is by default 0.5. It is similar to mixing, but the less luminance the color is the less it is tinted with the tint color. This has the effect of black color still being black instead of becoming tinted.