I wanted to get a 20% shade of a Hex colour - 0x0018A8 - and found this useful site: https://www.hexcolortool.com/#ed1d23
Just set your base Hex colour, and then press Lighten or Darken by whatever percentage you require. Pretty nifty!
Although, if anyone knows an algorithm to do just the same, I would be happy to see it. Using the website means I have to calculate the percentages for my known colours. It would be easier to do it on the fly, which would mean I could alter my base colour, and have the percentage automatically calculated in my program
Brian
You always come up with tricky problems Brian! How do you do it? ;D ;D
This page has example code in C# and Phyton. Browse far down the page.
Never done it myself, but it should be possible to convert to IWB.
Good Luck!
Egil
Forgot the link:
https://stackoverflow.com/questions/9280902/what-algorithm-is-behind-the-gimps-color-to-alpha-feature/14915403#14915403 (https://stackoverflow.com/questions/9280902/what-algorithm-is-behind-the-gimps-color-to-alpha-feature/14915403#14915403)
I think this might kind of do what you are looking for it to do. Not exactly, but close and the code is fairly simple. You will just need to convert the hex to Red, Green, Blue and then do the calculation.
Bill
Bill,
That is pretty much spot on with the calculations. I have taken the liberty of modifying your program to show the Hex values from the RGB calculations, if that is ok?
Brian
Glad you can use it.
Bill
Right, after some modifications, I've now re-posted Bill's Darker or Lighter Colours program. Swapped the whole lot over to a Dialog window, which makes it easier to tab between the RGB edit boxes, and have added some features, so the user can copy any of the hex values
Program deleted from previous post
Edit: Added an icon, and some very minor tweaks
Brian
Updated - download from previous post. Added an icon, neater interface, few minor tweaks
Brian
Edit: Updated again!
Okay,
This is definitely the last update of this program! Main addition is the ability to swap the RGB values of the 10 shaded boxes to HEX, and vice-versa. Also added the percentage that a box is lighter or darker
Much better, I think, and thanks to Bill Haesslein for his swap code
Brian
Edit: Couldn't resist a couple of tweaks! Updated again . . .