Reputation: 5002
I'm trying to programmatically create some css borders and text-shadows (for a letterpress effect) with jQuery.
Given an RGB color value, I'd like to be able to calculate color variations much like 0to255 does.
For example, given the color #023f74, how do I come up with 4 shades lighter being #0363b7?
Upvotes: 3
Views: 1695
Reputation: 19492
A little play with hex - from any given color increment\decrement with a certain step until the end of the scale, white(fff shortened from ffffff) or black (000 - form 000000).
Upvotes: 1
Reputation: 9437
maybe you could convert the RGB color ro HSL or HSB / HSV then apply the variation and then back to RGB!
look here -> http://www.easyrgb.com/index.php?X=MATH <- for formulas for converting from and to HSL / HSB/ HSV and others...
Upvotes: 2