category: packages
canvas-theme
A UI component theme for Canvas LMS made by Instructure Inc.
This theme has a 3:1 minimum contrast requirement.
Installation
npm install @instructure/canvas-theme
Usage
Before mounting (rendering) your React application:
-
global theming:
import { theme } from '@instructure/canvas-theme'
theme.use()
-
application level theming:
import { theme } from '@instructure/canvas-theme'
ReactDOM.render(
<InstUISettingsProvider theme={theme}>
<App />
</InstUISettingsProvider>,
element
)
To override the variables:
-
globally:
import { theme } from '@instructure/canvas-theme'
theme.use({ overrides: { spacing: { xxxSmall: '0.3rem' } } })
-
application level:
import { theme } from '@instructure/canvas-theme'
const themeOverrides = { spacing: { xxxSmall: '0.3rem' } }
ReactDOM.render(
<InstUISettingsProvider theme={{ ...theme, ...themeOverrides }}>
<App />
</InstUISettingsProvider>,
element
)