Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Background: I wanted a way of displaying some html with different shading depending on a given criterion. I didn't want completely different colors - 1 color with different levels of brightness.
This snippet will convert a hex color to RGB, shift the levels up and down by a given value, then convert back to HTML valid HEX (not necessarily web-safe). It returns: 1. lighter color than orig. 2. darker color than orig. Potential Uses: Well, I am using this for a diary system, the cells in the month-view-calendar will be shaded diferently depending on how many meetings\reminders I have on that day. But I am sure you can thing of other reasons to do it. Notes: It might not work so well when any of the RGB values are close to 0 or 255. There may also be a neater way of doing it.... Comments welcome...
In reply to Shading with HTML colors - color_munge by $code or die
|
|