docs: Add dark mode (#17940)

Closes https://github.com/zed-industries/zed/issues/17911

This PR enables dark mode on the documentation. This is done without any
special plugins, just pure JavaScript and CSS variables. I may open
fast-follow PRs to fine-tune design and code details that haven't been
super polished yet. For example, when switching to dark mode, the
`class` attribute on the `html` tag would change immediately, whereas
other attributes such as `data-theme` and `data-color-scheme` would
require a full refresh. This seems to be resolved, but not 100%
confident yet.

---

Release Notes:

- Enabled dark mode on the documentation
This commit is contained in:
Danilo Leal
2024-09-17 12:39:06 -03:00
committed by GitHub
parent 10cfaecffa
commit 7c54965b11
7 changed files with 224 additions and 46 deletions
+7 -7
View File
@@ -174,10 +174,10 @@ h6:target::before {
}
.content a {
text-decoration: underline;
text-decoration-color: hsl(219, 93%, 42%, 0.2);
text-decoration-color: var(--link-line-decoration);
}
.content a:hover {
text-decoration-color: hsl(219, 93%, 42%, 0.5);
text-decoration-color: var(--link-line-decoration-hover);
}
.content img,
.content video {
@@ -219,7 +219,7 @@ table thead td {
}
table thead th {
padding: 6px 12px;
color: #000;
color: var(--full-contrast);
text-align: left;
border: 1px var(--table-border-color) solid;
}
@@ -235,7 +235,7 @@ blockquote {
margin: auto;
margin-top: 1rem;
padding: 1rem 1.25rem;
color: #000;
color: var(--full-contrast);
background-color: var(--quote-bg);
border: 1px solid var(--quote-border);
}
@@ -315,7 +315,7 @@ kbd {
font-size: 1.4rem;
margin: 0.5em 0;
border-bottom: 1px solid;
border-color: var(--border-light);
border-color: var(--divider);
}
.footnote-definition p {
display: inline;
@@ -356,6 +356,6 @@ kbd {
}
code.hljs {
color: hsl(221, 13%, 10%) !important;
background-color: hsla(221, 93%, 42%, 0.1);
color: var(--code-text) !important;
background-color: var(--code-bg);
}