sandoche / Darkmode.js

🌓 Add a dark-mode / night-mode to your website in a few seconds
https://darkmodejs.learn.uno
MIT License
2.73k stars 175 forks source link

Feature Request: Add option to set backgroundColor in light mode and dark mode separately. #99

Open qwerzl opened 1 year ago

qwerzl commented 1 year ago

Hi there, first of all, thank you for your work!

It would be nice if it's possible to set the background color separately like as following:

const options = {
  bottom: '64px', // default: '32px'
  right: 'unset', // default: '32px'
  left: '32px', // default: 'unset'
  time: '0.5s', // default: '0.3s'
  mixColor: '#fff', // default: '#fff'
  backgroundColorDark: '#fff',  // default: '#fff'
  backgroundColorLight: '#000',
  buttonColorDark: '#100f2c',  // default: '#100f2c'
  buttonColorLight: '#fff', // default: '#fff'
  saveInCookies: false, // default: true,
  label: '🌓', // default: ''
  autoMatchOsTheme: true // default: true
}

In my specific case, I would like my website to be #000 in light mode, but when the darkmode is applied, the color #FFF is far too dark. It really affects the reading experience.

Purfview commented 1 year ago

You can set backgroundColor to whatever you want.

When darkmode is off then you should remove custom background:

document.getElementsByClassName('darkmode-background')[0].remove();

aysal04 commented 1 year ago

Is this issue open now?

Purfview commented 1 year ago

Is this issue open now?

If you see "Open" in a green background at the top-left side of the page then it's open.