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

Dark mode? #1

Closed
maxcountryman opened this issue Mar 25, 2023 · 7 comments
Closed

Dark mode? #1

maxcountryman opened this issue Mar 25, 2023 · 7 comments
Labels
wontfix This will not be worked on

Comments

@maxcountryman
Copy link

Hi, I'm coming from windy and with that plugin dark mode "just worked" which as I understand is a feature of Radix.

Unfortunately it doesn't seem like this plugin is a drop-in replacement in that regard.

@mrcaidev
Copy link
Owner

No, it's not. You have to manually add dark mode classes like bg-gray-1 dark:bg-graydark-1. But yes, it is, if you use component classes like bg-gray-app, which is a shorthand for bg-gray-1 dark:bg-graydark-1, as documented in the README, although not recommended.

This is on purpose because not everyone wants dark mode in every projects. Automatic dark mode may produce unused CSS in these situations.

Besides, this aligns with Tailwind's utility-first approach, where atomic class names are combined to form complex styles.

So after a hard time balancing convenience and flexibility, I personally decided to leave the dark mode classes to the users, who may then gain more granular control.

@mrcaidev mrcaidev added the wontfix This will not be worked on label Mar 25, 2023
@mrcaidev mrcaidev pinned this issue Mar 25, 2023
@maxcountryman
Copy link
Author

Well that's a bummer.

That basically means I can't use your plug-in.

@mrcaidev
Copy link
Owner

Sad. 😥 But there are excellent similar packages around too, some of which surely includes automatic dark mode.

I'm not saying it's wrong to handle dark mode for users, but there are certainly some users who would like to decide the adoption of dark mode by themselves, like they would do in original Tailwind CSS.

Or maybe we can provide a configurable option that lets the user decide whether to enjoy automatic dark mode, which should be enabled by default, and falls back to manual control if specified.

@maxcountryman
Copy link
Author

I'm not saying it's wrong to handle dark mode for users, but there are certainly some users who would like to decide the adoption of dark mode by themselves, like they would do in original Tailwind CSS.

This is configurable, it's not forced upon the user. For example, the windy docs outline two options via Tailwind.

Or maybe we can provide a configurable option that lets the user decide whether to enjoy automatic dark mode, which should be enabled by default, and falls back to manual control if specified.

This is how Radix is intended to work as far as I understand.

@mrcaidev
Copy link
Owner

This is configurable, it's not forced upon the user.

Either class or media, windy is shipping dark classes to the user anyway. But there can be some projects where you only want one variant, like light mode only or dark mode only, right?

@mrcaidev
Copy link
Owner

One more thing - windy does its magic by injecting css variables with addBase, while this plugin made it with native Tailwind palette.

The two solutions both have their cons: windy may introduce unused css variables into the bundle, and this plugin cannot support automatic dark mode.

Can't seem to be able to find a perfect solution in the current version of Tailwind. So that's something developers have to balance, i.e. automatic dark mode or minimal bundle size.

@erlendtryti
Copy link

Since you recently added the config option to disable semantic classes, do you plan on also adding an option to automatically set dark mode?

@mrcaidev mrcaidev unpinned this issue May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants