Currently, I am in the process of developing a screenshot application to enhance my understanding of HTML, CSS, and Electron. One of the key features I have implemented is a toggleable overlay consisting of a 0.25 opacity transparent box that covers the entire screen. Additionally, there is a transparent red outlined box that users can drag to select an area for capturing screenshots.
https://i.stack.imgur.com/N5QpV.png
The challenge I am facing is that because the red box sits on top of the 0.25 opacity box, it inherits the same opacity level as the rest of the screen. My goal is to make the area inside the red box appear as if it has 0.0 opacity, creating a "bright area" effect within the red box when compared to the rest of the screen's opacity levels. This desired effect can be visualized here:
https://i.stack.imgur.com/zdF66.png
I attempted to set the rgba value to (0,0,0,0) but did not see any changes as expected. Unfortunately, I have been unable to locate relevant CSS documentation on handling overlapping elements.
If you have any suggestions or ideas on how I can achieve this effect, your input would be greatly appreciated.