Comments (5)
I put the localstorage theme code first thing in the body tag. Works flawlessly without flash of wrong theme.
Example: https://github.com/sveltejs/svelte/blob/main/sites/svelte.dev/src/app.html
from skeleton.
Hey @kinglouie Thanks for the comment but like I said, though it happens so quickly on smaller sites, if your site is reasonably large and you will load the body first you might notice a flash of unstyled/wrongly styled content. I think we can both agree determining the style before the body
tag is even loaded would be optimal.
from skeleton.
My concern with this isn't so much a technical one, but one of education. Users will need to be informed that we diverge from Tailwind's recommend here. All their examples show the .dark
class appended to the HTML element. Their toggle code shows changing this.
https://tailwindcss.com/docs/dark-mode#supporting-system-preference-and-manual-selection
from skeleton.
My concern with this isn't so much a technical one, but one of education. Users will need to be informed that we diverge from Tailwind's recommend here. All their examples show the
.dark
class appended to the HTML element. Their toggle code shows changing this.https://tailwindcss.com/docs/dark-mode#supporting-system-preference-and-manual-selection
Isn't is the opposite in this case? Instead of the user defining theme and mode in different places they both are applied to the HTML element. The only confusing part is that Skeleton calls dark
/light
"mode" and Tailwind calls this "theme". (IMO Tailwind is in the wrong here, but whatever)
from skeleton.
The value of theme
is just what they use as their localstorage key in the example. It's poor semantics on their part!
But what I'm referring to is this:
document.documentElement.classList.add('dark')
This modifies the <html>
tag, not the <body>
.
I bring this up as folks that are familiar with Tailwind may be used to setting/adjusting this value on the <html>
element, per the official Tailwind docs recommending this approach. We can inform folks that we differ from the Tailwind norm here, but just stating the obvious that this may trip up some folks and cause some support issues :)
from skeleton.
Related Issues (20)
- NEXT Doc Search HOT 7
- Package and doc issues to resolve HOT 3
- NEXT: Installation page misspells "configure" twice HOT 1
- Web site Theme Error On Arc HOT 3
- ListBox + Popup on a Modal HOT 5
- Tailwind v4 Oxide <--> Skeleton v3 HOT 6
- Chore: Add `environment info` request on bug tickets
- Standardize Dev Tooling and CI Pipelines HOT 15
- Some v2 doc images are not displaying HOT 1
- Integration: Data Visualization
- v3 Custom Theme Doc Errors
- v3 Tailwind > Gradients CSS button has broken link
- Review "RestProps" spread method for arbitrary attributes HOT 2
- v3 Switch Component - Quick Patch
- computed styles not being applied HOT 3
- Repeated word in Docs HOT 1
- Audio/video components
- Svelte v5 RC: InputChip component produces errors HOT 9
- v3 React AppBar does not follow export conventions HOT 1
- v3 - consistency -D and --save-dev HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from skeleton.