gatsby-plugin-theme-ui
Version:
Gatsby plugin for adding Theme UI context
18 lines (15 loc) • 469 B
JavaScript
import * as React from 'react'
import { jsx, InitializeColorMode } from 'theme-ui'
import { WrapRootElement } from './src/provider'
export const onRenderBody = (
{ setPreBodyComponents },
{ injectColorFlashScript = true }
) => {
if (injectColorFlashScript) {
setPreBodyComponents([
jsx(InitializeColorMode, { key: 'theme-ui-no-flash' }),
])
}
}
export const wrapRootElement = ({ element }) =>
React.createElement(WrapRootElement, { element })