Skip to content

Add dark mode to site #1168

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions site/public/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
--font-size-base: 16px;
--color-text: hsl(12, 5%, 4%);
--color-border: hsl(17, 24%, 90%);
color-scheme: light dark;
}

html {
Expand All @@ -13,7 +14,7 @@ html {
}

body {
color: hsla(0, 0%, 0%, 0.8);
color: light-dark(hsla(0, 0%, 0%, 0.8), white);
font-family: 'Source Sans Pro', 'Helvetica Neue', 'Segoe UI', 'Helvetica', 'Arial', sans-serif;
font-weight: 400;
word-wrap: break-word;
Expand Down Expand Up @@ -44,7 +45,7 @@ h1 {
text-rendering: optimizeLegibility;
font-size: 2rem;
line-height: 1.1;
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
border-bottom: 1px solid light-dark(rgba(0, 0, 0, 0.2), rgba(255, 255, 255, 0.5));
}
h2 {
margin-top: 1.5rem;
Expand Down Expand Up @@ -225,7 +226,7 @@ li > p {
code {
font-size: 0.85rem;
line-height: 1.5rem;
background: rgba(0, 0, 0, 0.05);
background: light-dark(rgba(0, 0, 0, 0.05), rgba(255, 255, 255, 0.2));
padding: 0 0.25em;
border-radius: 3px;
border: 1px solid rgba(0, 0, 0, 0.1);
Expand Down Expand Up @@ -254,7 +255,7 @@ td:last-child {
padding-right: 0;
}
a {
color: #007a3d;
color: light-dark(#007a3d, #00cd70);
}

nav {
Expand Down
12 changes: 6 additions & 6 deletions site/src/components/component-name-matrix.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
background: white;
border-bottom: 1px solid rgba(0, 0, 0, 0.5);
background: Canvas;
border-bottom: 1px solid light-dark(rgba(0, 0, 0, 0.5), rgba(255, 255, 255, 0.5));
}

.component-name-matrix .cell {
Expand All @@ -30,16 +30,16 @@
overflow: hidden;
height: 2rem;
line-height: 1.2;
border-right: 1px solid rgba(0, 0, 0, 0.1);
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
border-right: 1px solid light-dark(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.1));
border-bottom: 1px solid light-dark(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.1));
}
.component-name-matrix .cell.found {
background: rgba(0, 255, 0, 0.1);
color: rgb(0, 64, 0);
color: light-dark(rgb(0, 64, 0), rgb(0, 191, 0));
}
.component-name-matrix .cell.not-found {
background: rgba(255, 0, 0, 0.1);
color: rgb(64, 0, 0);
color: light-dark(rgb(64, 0, 0), rgb(191, 0, 0));

}
.component-name-matrix a.cell {
Expand Down
5 changes: 3 additions & 2 deletions site/src/components/component-name-matrix.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ const SORT_NEXT = {
MATCH_COUNT: SORT_OPTIONS.COMPONENT_NAME,
}

const ComponentNameMatrix = (props) => {
const [sort, setSort] = useState(SORT_OPTIONS.COMPONENT_NAME)
function ComponentNameMatrix() {
// const [sort, setSort] = useState(SORT_OPTIONS.COMPONENT_NAME)
const [sort, setSort] = [SORT_OPTIONS.COMPONENT_NAME, () => {}]

const getMatchName = (name) =>
name
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/navigation/navigation-item.astro
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const relVal = shouldPrefetch ? 'prefetch' : ''

a[aria-current='page'] {
border-left-color: #00a453;
background-color: #f2f2f2;
background-color: light-dark(#f2f2f2, #2d2c2c);
}

</style>
1 change: 0 additions & 1 deletion site/src/components/specimens.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
position: relative;
padding: 4px 8px;
min-width: 120px;
color: rgba(0, 0, 0, 0.5);
border-top: 1px solid #ccc;
font-size: 0.8rem;
}
Expand Down
3 changes: 3 additions & 0 deletions site/src/styles/research.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@

.true {
background: #a3edac;
color: black;
}

table.research td:not(.true):not(.false) {
background: #ffffca;
color: black;
}

table.nowrap-first-column td:nth-child(1):not(.false):not(.true) {
background: initial;
color: initial;
}

/* Should be applied to a td/th
Expand Down
1 change: 1 addition & 0 deletions site/src/styles/spec.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dd + dt {

.question {
background: #f7f781;
color: black;
position: relative;
display: flex;
padding: 0.5em;
Expand Down