-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhistoire.config.ts
72 lines (68 loc) · 2.22 KB
/
histoire.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { HstSvelte } from '@histoire/plugin-svelte'
import { TonalPalette, argbFromHex, hexFromArgb, themeFromSourceColor } from '@material/material-color-utilities'
import { type HistoireConfig, defineConfig } from 'histoire'
const theme = themeFromSourceColor(argbFromHex('#6750a4'))
const extractGrayColorFromPalette
= (palette: TonalPalette): HistoireConfig['theme']['colors']['gray'] =>
Object.fromEntries(
[50, 100, 200, 300, 400, 500, 600, 700, 750, 800, 850, 900]
.map(value => [value, hexFromArgb(palette.tone(100 - (value / 10)))]),
)
const extractPrimaryColorFromPalette
= (palette: TonalPalette): HistoireConfig['theme']['colors']['primary'] =>
Object.fromEntries(
[50, 100, 200, 300, 400, 500, 600, 700, 800, 900]
.map(value => [value, hexFromArgb(palette.tone(100 - (value / 10)))]),
)
export default defineConfig({
backgroundPresets: [
{
color: 'var(--md-sys-color-surface)',
label: 'Surface',
},
{
color: 'var(--md-sys-color-surface-container-lowest)',
label: 'Surface Container Lowest',
},
{
color: 'var(--md-sys-color-surface-container-low)',
label: 'Surface Container Low',
},
{
color: 'var(--md-sys-color-surface-container)',
label: 'Surface Container',
},
{
color: 'var(--md-sys-color-surface-container-high)',
label: 'Surface Container High',
},
{
color: 'var(--md-sys-color-surface-container-highest)',
label: 'Surface Container Highest',
},
{
color: 'transparent',
label: 'Transparent',
},
],
outDir: 'dist',
plugins: [HstSvelte()],
routerMode: 'hash',
setupFile: './histoire.setup.ts',
theme: {
colors: {
gray: extractGrayColorFromPalette(theme.palettes.neutral),
primary: extractPrimaryColorFromPalette(theme.palettes.primary),
},
favicon: 'favicon.svg',
logo: {
dark: '/favicon.svg',
light: '/favicon.svg',
square: '/favicon.svg',
},
logoHref: 'https://github.com/importantimport/shiraha',
storeColorScheme: true,
title: 'Shiraha',
},
tree: { file: ({ path, title }) => [...path.slice(4).split('/').slice(0, -1).map(str => str.at(0).toUpperCase() + str.slice(1)), title] },
})