Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable Dark Mode ClassName #5800

Closed
wants to merge 5 commits into from

Conversation

azriel46d
Copy link

Small PR to make the default .dark className configurable.

Reason for this is that utilising Tailwind with mobile frameworks , particularly Nativescript, there could be a different className utilised.
In the case of Nativescript, the default className utilised is .ns-dark for when the phone is set to darkMode.
see https://docs.nativescript.org/ui-and-styling.html#css-overview

@ghost
Copy link

ghost commented Oct 31, 2021

Tailwindcss doesn't allow class customization because it can be confusing if we see a different design choice in each project.

@adamwathan
Copy link
Member

Made some changes to how this works, instead of adding another key I've just made it use an optional tuple syntax:

// tailwind.config.js
module.exports = {
  darkMode: ['class', '.test-dark'],
  // ...
}

I had to rebase and fix some conflicts so I couldn't easily make the changes directly to the PR and had to instead merge manually, so I have to close this but I have merged the changes and you are credited in the commit history 👍🏻

Need to review this with some other folks on the team before we actually put it in a release to make sure there's no good reasons to not support this, but I expect we should be able to include it in the next release. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants