frewsxcv / rust-dark-light

Rust crate to detect if dark mode or light mode is enabled
https://crates.io/crates/dark-light
81 stars 15 forks source link

Linux & BSD support #6

Closed Be-ing closed 2 years ago

Be-ing commented 2 years ago

This is #4 squashed and with a few small commits split out, plus updating README.md, formatting changes, and fixing a few clippy warnings.

Be-ing commented 2 years ago

Unfortunately it seems the KDE method is not really working. I suggest we change to the same method as KDE's implementation of the XDG Desktop Portal by reading the BackgroundNormal key under Colors:Window in $XDG_CONFIG_DIR/kdeglobals and calculating the grayscale value of that color.

edfloreshz commented 2 years ago

Alright, I'll get on that next 👍

Be-ing commented 2 years ago

Maybe serde_ini could help? I'm not sure.

Be-ing commented 2 years ago

The calculation of the grayscale value with qGray is simply (r * 11 + g * 16 + b * 5)/32.

edfloreshz commented 2 years ago

Done, could you test it before we merge @Be-ing?

frewsxcv commented 2 years ago

I just enabled GitHub Actions for CI. Mentioning in case you want to merge/rebase to pick that up here

edfloreshz commented 2 years ago

After @Be-ing's approval, we'll be ready for merge @frewsxcv, should we merge or rebase?

frewsxcv commented 2 years ago

I have no preference between rebasing/merging/squashing. Do whatever you'd like!

edfloreshz commented 2 years ago

Closes #1

Be-ing commented 2 years ago

I tested this on KDE Plasma 5.23.4 on Fedora 34 switching between several color schemes and it works! Great job!

edfloreshz commented 2 years ago

Awesome! Great job as well @Be-ing and @frewsxcv, cheers 🥂

edfloreshz commented 2 years ago

By the way, I've been improving the code, looks way better.

I'll try to upload the commit tonight so you can review it in the morning. unless you're a night owl 🦉

Be-ing commented 2 years ago

@frewsxcv shall we make a new release now that this is merged?

edfloreshz commented 2 years ago

How about we wait until we have #10 ready?

Be-ing commented 2 years ago

10 may take some time to polish and implement on all platforms. I don't think we need to hold back a release for that. Version numbers are cheap. :)

edfloreshz commented 2 years ago

Alright then! 👍🏼

frewsxcv commented 2 years ago

0.2.0 released!