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

Configure/disable light/dark mode custom variables? #828

Open
j9t opened this issue Oct 8, 2024 · 3 comments
Open

Configure/disable light/dark mode custom variables? #828

j9t opened this issue Oct 8, 2024 · 3 comments

Comments

@j9t
Copy link

j9t commented Oct 8, 2024

Lightning CSS inserts code like --lightningcss-light:initial;--lightningcss-dark: ;, apparently on encountering the color-scheme property. Unless I’m missing something (pointer appreciated), it would be great to be able to disable this code being added.

@devongovett
Copy link
Member

raise your browser targets to ones where light-dark is supported natively.

@j9t
Copy link
Author

j9t commented Oct 9, 2024

Got it, thanks @devongovett. Do you want to keep this open if this could be interesting to make configurable, or do you consider this done implicitly by means of browser targeting?

@kizu
Copy link

kizu commented Dec 16, 2024

This is also something that we would love to have.

Why: we have our own pre-existing solution that uses the same technique (space toggles), but which is applied in a slightly different way.

So, if we have color: light-dark(#fff, #000), right now, Lightning CSS transforms its usage into color: var(--lightningcss-light, #fff) var(--lightningcss-dark, #000), but we want to use our existing variables: color: var(--LIGHT, #fff) var(--DARK, #000).

Also, because we already have all the setup needed (and a more elaborate than what Lightning CSS outputs), we'd also want to have an option to completely omit the setup code (the one that conditionally switches the space toggles).

So, a proposal: a new config option, something like

lightDark: {
    lightVariable: '--LIGHT',
    darkVariable: '--DARK',
    omitSetup: true,
},

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

No branches or pull requests

6 participants
@devongovett @kizu @j9t and others