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

Fetch macOS dark mode without spawning shell. #9

Closed frewsxcv closed 2 years ago

frewsxcv commented 2 years ago

Fixes #2.

ryanmcgrath commented 2 years ago

This looks overall good to me, only two things I'd note:

1) You might want to do some kind of check for pre-10.14 and just return false, since dark mode didn't exist then. Your call - I personally would drop High Sierra like a rock, but I could see this being confusing to an end-user to track down.

2) A line of credit? >.>

Do you need a sanity check on actually running this? If you do (i.e if you don't have a Mac) I can do so when at my laptop later today.

frewsxcv commented 2 years ago

This looks overall good to me, only two things I'd note:

1. You might want to do some kind of check for pre-10.14 and just return `false`, since dark mode didn't exist then. Your call - I _personally_ would drop High Sierra like a rock, but I could see this being confusing to an end-user to track down.

2. A line of credit? >.>

Do you need a sanity check on actually running this? If you do (i.e if you don't have a Mac) I can do so when at my laptop later today.

I have a Mac and tested this! Thanks for the offer though. How do the latest two commits look?

I went the respondsToSelector route to avoid pulling in a separate crate to detect the OS version. Also let me know if you prefer to be attributed some other way! I'm very flexible! Appreciate your help 🙇🏻