-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
Docs dark mode #28449
Docs dark mode #28449
Conversation
Nice ! 👍 Just a question, how do you switch to dark mode ? |
Third line of the PR you have this
|
@mdo This looks nice. |
Yeah, support is real bad right now for this, but currently no plans for manual toggle at this time. Maybe there's a polyfill or something else we can look into though? |
won't be properly polyfillable, as it needs the ability of the browser to read a system/OS preference and set the media query accordingly. a polyfill obviously can't access system/OS specific flags. either we double the whole dark mode media query up with a "or there's this class on the body" or similar approach (and then authors can write their own toggle that sets/unsets dark mode), or...we just leave it as it is. [edit] addendum: similarly, we don't do anything for |
I would like a button to switch to the dark mode. A simple button which add a css class on the body or html element |
Hmmm...I don't feel like it's a good common component as part of vanilla bootstrap to be honest. It seems to cross a line for me between providing some general purpose building blocks and a very specific control that affects the entire page/site (would also need to include cookie handling or session storage to remember the setting across multiple pages of a site, etc). [edit] if you mean a button for docs specifically (i.e. we're not talking about a component in bootstrap itself), then ok, maybe...feels clunky though (and you can bet there will then be issues filed along the lines of "why does bootstrap not ship with that control so i can easily add it to my site?") |
Yep I thought about that only for our docs, not in Bootstrap itself |
^^ yeah, agreed. We need a toggle button, and save the preference in local storage. |
@Johann-S Can you explore options for stylesheets and local storage without jQuery? Ideally we can treat this new |
We can just build this scss to a separate CSS file, and load it when the button is toggled. EDIT: Pushed a couple of patches, the last one will be removed when we have the JS part. |
9b8ce02
to
564a3cb
Compare
Yup that's what I was saying in my last comment :). Thanks for the commit to add the separate file! |
2e1287a
to
a40ab37
Compare
BTW, I'm waiting for FF 67 to hit the beta channel which should be this week to try this and add the button. Where should we add the button? EDIT: All right, I tested this and works fine on Windows 10 with FF 67. So, now the button placement is left. Maybe it should be in the navbar? If so, we should have an SVG icon, suggestions welcome. |
a40ab37
to
a95da2d
Compare
b3ca9b7
to
96e10c0
Compare
Place it anywhere for now on a page and I can style/place it beyond that :). |
We have two solutions. One is to load the script on button click and the
other just do something like .dark .foo and only add/remove the html class.
Which solution do you guys prefer?
…On Wed, Mar 20, 2019, 00:13 Mark Otto ***@***.***> wrote:
So, now the button placement is left. Maybe it should be in the navbar? If
so, we should have an SVG icon, suggestions welcome.
Place it anywhere for now on a page and I can style/place it beyond that
:).
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#28449 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAVVtTECp-yrd5B2bjYEmPMrUi-bJRDgks5vYWEhgaJpZM4bnr8m>
.
|
07efada
to
3866dab
Compare
Hi everybody, I changed a lot of things, and I removed I hope my changes won't bother you, feel free to nuke everything 👍 |
48daa73
to
ce48d9c
Compare
4ff77b1
to
b49a826
Compare
a786731
to
df9e5ee
Compare
This needs an update @mdo. I rebased the branch BTW. |
df9e5ee
to
23366d0
Compare
I filed a pull request that introduces mix-ins for |
51a9481
to
26871c8
Compare
Personally, I'm not a fan of this yet. This will be easier to achieve when we have CSS variables available, otherwise this will be a PITA to maintain. We can't also just add a dark mode to our docs and don't support it in our components. It will just look too weird to have light components (like modals or dropdowns) in a dark documentation. An other aspect is color contrast, we already struggle to get the color contrast on point without the dark mode, checking two modes won't make that easier. |
Yeah, I agree. We need to postpone this for when we support CSS variable only. Unless there's a way to do this right now with a fallback, but I'm not sure what the overhead will be. |
be89a3a
to
22df0bb
Compare
Closing as stale. |
This worked up to some point but we can use CSS variables now so this can be simplified a lot. |
This is still a little WIP and not perfect given how many live examples we have in our docs, but it's not bad. I've gone the route of overriding default values surgically. Still have some work to do on seeing how I could maybe improve the live examples.
Live preview: https://deploy-preview-28449--twbs-bootstrap.netlify.com/
TODO:
text-muted
so that its contrast ratio is >= 4.5#767676
and#77757a
and adapt the cases