2018-04-09 23:04:39 +01:00
|
|
|
## Theming
|
|
|
|
|
2018-12-11 15:31:48 +00:00
|
|
|
This document describes how to write your own theme for Pinafore.
|
|
|
|
|
|
|
|
First, create a file `scss/themes/foobar.scss`, write some SCSS inside and add
|
|
|
|
the following at the bottom of `scss/themes/foobar.scss`.
|
2018-04-09 23:04:39 +01:00
|
|
|
```scss
|
|
|
|
@import "_base.scss";
|
|
|
|
|
|
|
|
body.theme-foobar {
|
|
|
|
@include baseTheme();
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2018-12-11 15:31:48 +00:00
|
|
|
> Note: You can find all the SCSS variables available in `scss/themes/_default.scss`
|
|
|
|
> while the all CSS Custom Properties available are listed in `scss/themes/_base.scss`.
|
2018-04-09 23:04:39 +01:00
|
|
|
|
2018-12-11 15:31:48 +00:00
|
|
|
Then, Add your theme to `src/routes/_static/themes.js`
|
2018-04-09 23:04:39 +01:00
|
|
|
```js
|
|
|
|
const themes = [
|
|
|
|
...
|
|
|
|
{
|
|
|
|
name: 'foobar',
|
2018-09-23 20:26:01 +01:00
|
|
|
label: 'Foobar', // user-visible name
|
|
|
|
color: 'magenta', // main theme color
|
|
|
|
dark: true // whether it's a dark theme or not
|
2018-04-09 23:04:39 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
2019-01-28 01:44:30 +00:00
|
|
|
Start the development server (`yarn run dev`), go to
|
2018-12-11 15:31:48 +00:00
|
|
|
`http://localhost:4002/settings/instances/your-instance-name` and select your
|
|
|
|
newly-created theme. Once you've done that, you can update your theme, and refresh
|
|
|
|
the page to see the change (you don't have to restart the server).
|