Fun With Math
- Started
- Last post
- 9 Responses
- ian00
Does anyone know a good way to add or multiply hex colors mathematically? I am working on a magazine site and the clients wants to be able to change the color scheme every issue. I would like them to be able to enter one hex value and then a php script will calculate various oppacities of that color (fundamentally, I would like to add a certain amount of white to any given color). Here is a jpg of what I am trying to achieve:
Also, here are a few examples in context of the site:
http://clients.chemset.net/artli…
http://clients.chemset.net/artli…
http://clients.chemset.net/artli…
http://clients.chemset.net/artli…Thanks in advance. I know you will come through.
(heart)
- ethangl0
math is never fun
- ian000
dude...
math is ALWAYS fun.
- nuarmy0
i hate math.
- ian000
Perhaps I should have named this thread something else. Oh, well. I'm still holding out hope for PVN.
- nigelk20
Can't you just do this in RGB and then convert to Hex at the last minute. Adding a tint of white is a simple percentage calculation between the colour you have (RGB) and the RGB value for pure white 255,255,255.
Or have I missed something here?
- nigelk20
An example:
newRed+=(255-origRed)*(1-(Tint/1...
where Tint is the percent (e.g. 10)
repeat for green and blue values.
- JamesEngage0
yep easier to work in 10's rather that 16's
- ian000
yes this works well but the sturation becomes an issue. if i am working with a dark blue i don't want a bright light blue. it needs to be washed out.
i think dealing with hsb is the way to go. i can leave the hue value the same and change the other by some constant multiple.