flavours icon indicating copy to clipboard operation
flavours copied to clipboard

Automatically determine dark/light theme from theme colors

Open tbethe opened this issue 1 year ago • 1 comments

So, I have this weird idea. There are some programs that I do not want to theme, but I just want them to use their own dark or light theme. Which one, I would like to depend on the currently selected theme.

For this, I have the following idea: Take the background colors and take their average darkness (for example, by splitting up RGB, and seeing how dark they are) and using this to determine if the theme is more a light or dark theme.

Perhaps there could be a command line option to get the dark/lightness of the current theme.

Example of how to calculate this: https://stackoverflow.com/questions/596216/formula-to-determine-perceived-brightness-of-rgb-color

I'm planning to work on this and submit a pull request, at some point.

tbethe avatar Apr 25 '23 08:04 tbethe

This sounds good! Feel free to open up a PR.

Misterio77 avatar May 02 '23 01:05 Misterio77