@politiet/sheriff-designsystemet-theme
v1.0.0
Published
A Sheriff theme for designsystemet.no components
Keywords
Readme
Sheriff Designsystemet Theme
@politiet/sheriff-designsystemet-theme is a Sheriff theme for
Designsystemet.no.
Why
Designsystemet.no offers several useful components. This theme allows you to use them freely and get them themed as Sheriff components!
Installation
Install this theme's package along with @digdir's packages:
npm install @politiet/sheriff-designsystemet-theme @digdir/designsystemet-css @digdir/designsystemet-webUsage
Load Designsystemet's base CSS first, then this theme on top of it:
import '@digdir/designsystemet-css';
import '@politiet/sheriff-designsystemet-theme';Then use Designsystemet's components as usual. They will now be styled as Sheriff components.
<div data-color-scheme="light" data-color="accent" data-size="md">
<h1 class="ds-heading" data-size="lg">Designsystemet with the Sheriff theme</h1>
<button class="ds-button" data-variant="primary">Primary</button>
</div>Building the theme
We use Designsystemet's (DS) own tooling
(@digdir/designsystemet) to setup and build our theme.
scripts/sync-sheriff-tokens.mjsreads Sheriff's CSS colour variables writes them intodesignsystemet tokens build --config designsystemet.config.jsoncompiles the tokens intodesign-tokens-build/sheriff.css.- That file is copied to
dist/sheriff-theme.css, which is what the package publishes.
Run the whole pipeline:
npm run buildUpdating the source tokens
To re-scaffold the Designsystemet token source (for example after changing
designsystemet.config.json), see
design-tokens/README.md.
