Skip to content

Commit

Permalink
feat: Add dark mode in Gatsby site (#189)
Browse files Browse the repository at this point in the history
* enhancement: Add dark mode in Gatsby site

* lint

* Update site/src/css/authorpost.module.css

Co-authored-by: Kris Stern <[email protected]>

* Update site/src/css/blogpost.module.css

Co-authored-by: Kris Stern <[email protected]>

---------

Co-authored-by: Kris Stern <[email protected]>
  • Loading branch information
saurabhraghuvanshii and krisstern authored Dec 7, 2024
1 parent 6e74186 commit fc0dff6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion site/src/components/PageName.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const PageName = ({ title }) => (
<Link style={{ textDecoration: `none` }} to="/">
<h3
style={{
color: `black`,
marginBottom: rhythm(1.5),
fontFamily: "Georgia,serif",
fontSize: "2rem",
Expand All @@ -17,6 +16,7 @@ const PageName = ({ title }) => (
flexWrap: "nowrap",
justifyContent: "center",
gap: "15px",
color: "hsl(240, 15%, 10%)"? "white" : "black",
}}
>
<img
Expand Down
22 changes: 21 additions & 1 deletion site/src/css/blogpost.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
html {
font-size: 16px;
color-scheme: light dark;
}

* {
Expand Down Expand Up @@ -106,7 +107,7 @@ li {

.blogteaser {
position: relative;
color: hsl(212, 30%, 40%);;
color: hsl(212, 30%, 40%);
margin: 0;
text-decoration: none !important;
line-height: 1.66;
Expand Down Expand Up @@ -134,3 +135,22 @@ li {
top: 0.3rem;
margin-inline: 0.2rem;
}

@media screen and (prefers-color-scheme: dark) {
#contributor-grid * {
color: hsl(240, 15%, 95%);
}

body {
background-color: hsl(240, 15%, 10%);
color: hsl(240, 15%, 95%);
}

.blogtitle {
color: hsl(240, 15%, 95%);
}

.blogteaser {
color: hsl(240, 15%, 95%);
}
}

0 comments on commit fc0dff6

Please sign in to comment.