Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
gatsby-plugin-theme-ui
Advanced tools
Gatsby plugin for adding theme-ui context
npm i theme-ui gatsby-plugin-theme-ui @emotion/core @mdx-js/react
// gatsby-config.js
module.exports = {
plugins: ['gatsby-plugin-theme-ui'],
}
To customize the theme used in your Gatsby site, shadow files in a src/gatsby-plugin-theme-ui/
directory.
The src/gatsby-plugin-theme-ui/index.js
module is the main export for themes.
// example src/gatsby-plugin-theme-ui/index.js
export default {
colors: {
text: '#111',
background: '#fff',
},
}
To extend an existing theme, import the presets module by running npm i @theme-ui/presets
then merge, assign or override properties in your shadowing src/gatsby-plugin-theme-ui/index.js
file.
// example with extending
import { base } from '@theme-ui/presets'
export default {
...base,
// extending the colors only
colors: {
...base.colors,
text: '#111',
background: '#fff',
},
}
To extend a theme in another Gatsby theme built with Theme UI, this same approach will work.
// example extending from a Gatsby theme
import baseTheme from 'gatsby-theme-blog/src/gatsby-plugin-theme-ui'
export default {
...baseTheme,
colors: {
...baseTheme.colors,
text: '#111',
background: '#fff',
},
}
To enable support for multiple color modes, add an initialColorMode
field to your theme.js
object.
// src/gatsby-plugin-theme-ui/index.js
export default {
initialColorMode: 'light',
colors: {
text: '#000',
background: '#fff',
modes: {
dark: {
text: '#fff',
background: '#000',
},
},
},
}
Custom MDX components that will receive styles from the theme can be included by adding a src/gatsby-plugin-theme-ui/components.js
module.
// example src/gatsby-plugin-theme-ui/components.js
export default {
h1: props => (
<h1 {...props}>
<a href={`#${props.id}`}>{props.children}</a>
</h1>
),
}
MIT License
v0.2.2 2019-07-02
key
prop to element in gatsby-plugin-theme-ui #145FAQs
Gatsby plugin for adding Theme UI context
The npm package gatsby-plugin-theme-ui receives a total of 3,003 weekly downloads. As such, gatsby-plugin-theme-ui popularity was classified as popular.
We found that gatsby-plugin-theme-ui demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.