karakanb / devo

A Chrome and Firefox extension that displays GitHub Trending, Hacker News, Product Hunt and Designer News on every new tab.
https://burakkarakan.com/devo/
MIT License
406 stars 47 forks source link

Support toggling dark mode automatically. #59

Closed DannySu09 closed 3 years ago

DannySu09 commented 3 years ago

Hi, I found Devo is still in bright mode when My Browser have been in dark mode. So I make some changes to the code:

  1. Checking dark mode automatically which is with this.nowTime under the same setInterval.
  2. Adding a disableNightAutoToggle flag. When users trigger light/dark mode manually, the flag is turned true and the automatically dark mode checking will be blocked.
  3. Modifying the style of card body scrollbar and list items' border color to make the look more comfortable in dark mode.
karakanb commented 3 years ago

I have released v1.8.3 with these changes, it is already online on Mozilla Add-ons and should be available soon in Chrome Store too.

In terms of changes, I replaced your pseudo-selectors with the new CSS properties and then merged, but I have misread the version requirements for Chrome, so after I merged yours I had to bring back some of the changes you have originally done in the PR already, so thanks for that.

karakanb commented 3 years ago

It seems like we forgot a pretty obvious problem, and it hasn't occurred to me while testing this since Iam always in the dark mode anyway. I'll revert the changes done here unfortunately.

karakanb commented 3 years ago

I was thinking "we had something like this before" but I haven't checked it before merging this PR. Turns out we already had this feature: https://github.com/karakanb/devo/blob/master/src/store.js#L23-L29

The reason it didn't work for you is you have manually changed that selection, and that selection overrides this guess mechanism. I believe there is no reason to further complicate the setup here for this feature.

DannySu09 commented 3 years ago

I was thinking "we had something like this before" but I haven't checked it before merging this PR. Turns out we already had this feature: https://github.com/karakanb/devo/blob/master/src/store.js#L23-L29

The reason it didn't work for you is you have manually changed that selection, and that selection overrides this guess mechanism. I believe there is no reason to further complicate the setup here for this feature.

Thanks for the tip! It works after clear the LocalStorage.