I have a hex value of some color, for example #202010
.
How to generate a new color which is either lighter or darker given in percent (ie. 20% dar
The answers are wrong.
Using RGB model is a conceptual error.
You need to transform the color from RGB (or Hex form) into HSL.
That is Hue, Saturation, Lightness.
Once you convert it from RGB into HSL, to lighten up the color you simply adjust the L value (lightness) by 10%. Then once you are done you convert back from HSL to RGB and you are done.
Voila!
RGB to HSV in PHP