I'm trying to create a tool to help me with choosing colours for web applications. Basically, I want to be able to specify a final colour and some overlay parameters and determine what the underlying colour needs to be (or if it's possible to achieve with the specified parameters).
All overlays will be translucent black.
An example of how the system would work:
- I enter the following variables:
- finalColourRed: 128 [0-255]
- finalColourGreen: 118 [0-255]
- finalColourBlue: 107 [0-255]
- overlayOpacity: 0.21 [0-1]
- The system returns:
- rgb(183, 169, 154)
I should note that I don't need help with writing the actual code for this, I just don't know the mathematical formula to use and my Google-fu is weak today. The closest I could find was this excellent answer (https://stackoverflow.com/a/12228643/4027341) but it's missing an iteration for "knowing final desired colour, knowing overlay colour, knowing overlay opacity"