Misterio77 / flavours

🎨💧 An easy to use base16 scheme manager that integrates with any workflow.
MIT License
501 stars 29 forks source link

Automatically determine dark/light theme from theme colors #77

Open tbethe opened 1 year ago

tbethe commented 1 year ago

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.

Misterio77 commented 1 year ago

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