diff --git a/gatsby-config.js b/gatsby-config.js index 3d6ce9a..0bb460b 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -51,6 +51,7 @@ module.exports = { ], }, }, + 'gatsby-plugin-dark-mode', 'gatsby-transformer-sharp', 'gatsby-plugin-sharp', { diff --git a/package.json b/package.json index 37838c1..3f4e6e5 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "dependencies": { "gatsby": "^2.19.7", "gatsby-image": "^2.2.39", + "gatsby-plugin-dark-mode": "^1.1.1", "gatsby-plugin-feed": "^2.3.26", "gatsby-plugin-google-analytics": "^2.1.34", "gatsby-plugin-manifest": "^2.2.39", diff --git a/src/components/layout/layout.css b/src/components/layout/layout.css new file mode 100644 index 0000000..2d2c14c --- /dev/null +++ b/src/components/layout/layout.css @@ -0,0 +1,20 @@ + +body { + --bg: white; + --textNormal: #222; + --textTitle: #222; + --textLink: #62b61e; + --hr: hsla(0, 0%, 0%, 0.2); + + background-color: var(--bg); +} + +body.dark { + -webkit-font-smoothing: antialiased; + + --bg: darkslategray; + --textNormal: rgba(255, 255, 255, 0.88); + --textTitle: white; + --textLink: yellow; + --hr: hsla(0, 0%, 100%, 0.2); +} \ No newline at end of file diff --git a/src/components/layout/layout.js b/src/components/layout/layout.js index 7e3f599..aa4684e 100644 --- a/src/components/layout/layout.js +++ b/src/components/layout/layout.js @@ -3,6 +3,9 @@ import { Link } from 'gatsby'; import { PropTypes } from 'prop-types'; import { rhythm, scale } from '../../utils/typography'; +import ThemeToggle from '../theme-toggle/theme-toggle'; + +import './layout.css'; const Layout = ({ location, title, children }) => { // eslint-disable-next-line no-undef @@ -61,6 +64,7 @@ const Layout = ({ location, title, children }) => { }} >
{header}
+
{children}