-
Notifications
You must be signed in to change notification settings - Fork 3
/
_theme.scss
142 lines (130 loc) · 3.16 KB
/
_theme.scss
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
@import './variables';
/*
* NAMESPACE
* if updated process.env.BLUEPRINT_NAMESPACE needs to be updated as well
* https://blueprintjs.com/docs/#core/classes.namespacing
*/
$ns: map-deep-get($sl-variables, namespace) !default;
/*
* THEME
* accessible to all component scss through importing ./utils then using get-theme(colors, lighten, 1) or other helpers
* any value we want overwritable by the consumer needs to be an external variable defined in ./_variables $sl-defaults then referenced here
* this file should never be imported directly outside of ./utils
*/
$sl-theme: (
namespace: map-deep-get($sl-variables, namespace),
colors: map-deep-get($sl-variables, colors),
fontSize: (
xs: 9px,
sm: 11px,
base: 13px,
lg: 15px,
xl: 18px,
2xl: 22px,
3xl: 26px,
4xl: 32px,
5xl: 40px,
6xl: 50px,
),
borderRadius: (
none: 0,
sm: 1px,
default: 3px,
lg: 5px,
full: 9999px,
),
boxShadow: (
default: 0px 1px 2px rgba(0, 0, 0, 0.3),
md: 0px 4px 4px rgba(0, 0, 0, 0.5),
lg: 0px 5px 5px rgba(0, 0, 0, 0.6),
inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06),
outline: 0 0 0 3px rgba(66, 153, 225, 0.5),
none: none,
),
fontFamily: (
sans: (
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
Roboto,
'Helvetica Neue',
Arial,
'Noto Sans',
sans-serif,
'Apple Color Emoji',
'Segoe UI Emoji',
'Segoe UI Symbol',
'Noto Color Emoji',
),
serif: (
Georgia,
Cambria,
'Times New Roman',
Times,
serif,
),
mono: (
Menlo,
Monaco,
Consolas,
'Liberation Mono',
'Courier New',
monospace,
),
),
fontWeight: (
hairline: 100,
thin: 200,
light: 300,
normal: 400,
medium: 500,
semibold: 600,
bold: 700,
extrabold: 800,
black: 900,
),
);
// extend theme with extraneous things passed into $sl-variables
// examples include new variables defined by the consumer
@each $key, $value in $sl-variables {
@if not map-has-key($sl-theme, $key) {
$sl-theme: map-extend(
$sl-theme,
(
$key: $value,
)
);
}
}
/*
* UTILITIES
* some helpful functions to access the theme
*/
// returns the value at this theme path
@function get-theme($keys...) {
@return map-deep-get($sl-theme, $keys...);
}
// returns color at this path from theme
@function get-color($keys...) {
@return map-deep-get($sl-theme, colors, $keys...);
}
// returns fontSize at this path from theme
@function get-font-size($keys...) {
@return map-deep-get($sl-theme, fontSize, $keys...);
}
// returns borderRadius at this path from theme
@function get-border-radius($keys...) {
@return map-deep-get($sl-theme, borderRadius, $keys...);
}
// returns boxShadow at this path from theme
@function get-box-shadow($keys...) {
@return map-deep-get($sl-theme, boxShadow, $keys...);
}
// returns fontFamily at this path from theme
@function get-font-family($keys...) {
@return map-deep-get($sl-theme, fontFamily, $keys...);
}
// returns fontWeight at this path from theme
@function get-font-weight($keys...) {
@return map-deep-get($sl-theme, fontWeight, $keys...);
}