nuxt-modules / color-mode

Dark and Light mode with auto detection made easy with Nuxt 🌗
https://color-mode.nuxtjs.org
MIT License
1.12k stars 112 forks source link

feat: add general attribute support #215

Open miswanting opened 1 year ago

miswanting commented 1 year ago

https://tdesign.tencent.com/vue-next/dark-mode-en

Some UI libraries (such as TDesign) use a theme-mode attribute on HTML tags to control dark mode, which cannot be implemented by the existing dataValue option, so a new option named attrName is added, with control logic similar to that of 'dataValue'.

Also fixed missing 'dataValue' in the sample code.

nuxt-studio[bot] commented 1 year ago

Live Preview ready!

Name Edit Preview Latest Commit
Color Mode Edit on Studio ↗︎ View Live Preview de45ce0c7da1c02bd3142eb9d26f57dda1cee09a
netlify[bot] commented 1 year ago

Deploy Preview for nuxt-color-mode ready!

Name Link
Latest commit de45ce0c7da1c02bd3142eb9d26f57dda1cee09a
Latest deploy log https://app.netlify.com/sites/nuxt-color-mode/deploys/653791f4dc40dd0008fb174e
Deploy Preview https://deploy-preview-215--nuxt-color-mode.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

miswanting commented 1 year ago

You mean: keep these two options, but merge them into one implement code, in order to reduce the code duplicate?

If so, I`ll try.

And here's another thing I need your recommend: Is it okay to name such option as attrName? Or any name better?

atinux commented 1 year ago

@miswanting I think it would be nice to discuss with the TDesign team as the theme-mode is not a valid HTML attribute, I would recommend data-theme-mode in that case