I'm creating a GUI that has a double
slidePos from 0-1 that needs to dictate the color of a setting. The resulting color should always be at full saturation and 50% brightness. I need to convert the number from 0 to 1 into any color(i.e. three ints), where 0 is red, 0.333 is green, and 0.666 is blue. I would also need the reverse operation, taking three integers and turning them into a double from 0-1. How would I go about the math to make this work?
Asked
Active
Viewed 687 times
1

Mike Fitz
- 101
- 1
- 9
-
1Have you tried to calculate it on paper? Since it would make your life much easier when you recreate what you have written on paper. – n247s Aug 26 '17 at 18:13