0.3.9 • Published 5 years ago

gatsby-plugin-themes v0.3.9

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

gatsby plugin for themes (and switching between them)

This is a style system agnostic plugin. No matter what style system you are using (styled-components, emotion, theme-ui ...), you can use them with this plugin.

How to Use

In your gatsby-config.js file.

module.exports = {
  // ...
  {
    resolve: `gatsby-plugin-themes`,
    options: {
      themes: [
        `${__dirname}/src/themes/dark.js`,
        `${__dirname}/src/themes/light.js`,
      ],
    },
  }
  // ...
}

And anywhere in any of your components.

import React, { useContext } from 'react'
import { ThemeContext } from 'gatsby-plugin-themes'
// ...
const { theme, next } = useContext(ThemeContext)

Here the theme is one of your modules decleared in the gatsby-config.js file (in this example, dark.js or light.js). And I don't care what's in it, nor how you use it, you are the boss.

The next is a function to toggle between your themes. And that's about it. Enjoy.

0.3.9

5 years ago

0.3.8

5 years ago

0.3.7

5 years ago

0.3.6

5 years ago

0.3.5

5 years ago

0.3.4

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago