-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpalette.js
More file actions
55 lines (50 loc) · 1.35 KB
/
palette.js
File metadata and controls
55 lines (50 loc) · 1.35 KB
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
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable prefer-destructuring */
const colorLayer = require('color-layer');
const sharedConstants = {
fontDisplay: '-apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Ubuntu, "Arial", sans-serif',
gapXs: '0.25rem',
gapS: '0.5rem',
gapSm: '0.75rem',
gapM: '1rem',
gapL: '2rem',
gapXl: '4rem',
radiusS: '4px',
radiusM: '6px',
radiusL: '12px',
radiusXl: '20px',
brandColor: '#17b978',
colorPrimary: '#108858',
colorPrimaryAccent: '#17b978',
textColorPrimary: '#fff',
};
const themes = {
light: {
...sharedConstants,
textColor: 'hsl(0, 0%, 15%)',
backgroundColor: '#f6f9fc',
},
dark: {
...sharedConstants,
textColor: 'hsl(0, 0%, 90%)',
backgroundColor: '#121212',
},
};
// from 0 to 10
const levelsNumber = [...Array(11).keys()];
// [name, [hue, saturation]]
const colorsOptions = [
['gray', [1, 0]],
['warn', [30, 100]],
['danger', [360, 100]],
['link', [213, 100]],
['primary', [156, 100]],
];
colorsOptions.forEach(([name, [h, s]]) => {
levelsNumber.forEach((i) => {
const [light, dark] = colorLayer.default(h, i, s);
themes.light[`${name}${i}`] = light;
themes.dark[`${name}${i}`] = dark;
});
});
module.exports = themes;