|
1 | 1 | import CHART_PALETTE from 'app/constants/chartPalette'; |
2 | 2 |
|
3 | | -const theme = { |
4 | | - breakpoints: ['768px', '992px', '1200px'], |
5 | | - |
| 3 | +const colors = { |
6 | 4 | // Colors |
7 | 5 | offWhite: '#FAF9FB', |
8 | 6 | offWhite2: '#E7E1EC', |
@@ -71,6 +69,107 @@ const theme = { |
71 | 69 |
|
72 | 70 | background: '#fff', |
73 | 71 | placeholderBackground: '#f5f5f5', |
| 72 | +}; |
| 73 | + |
| 74 | +const warning = { |
| 75 | + backgroundLight: colors.yellowLightest, |
| 76 | + background: colors.yellowDarkest, |
| 77 | + border: colors.yellowDark, |
| 78 | + iconColor: colors.yellowDark, |
| 79 | +}; |
| 80 | + |
| 81 | +const alert = { |
| 82 | + muted: { |
| 83 | + backgroundLight: colors.offWhite, |
| 84 | + background: colors.gray1, |
| 85 | + border: colors.gray6, |
| 86 | + }, |
| 87 | + info: { |
| 88 | + backgroundLight: colors.blueLightest, |
| 89 | + border: colors.blueLight, |
| 90 | + iconColor: colors.blue, |
| 91 | + background: colors.blue, |
| 92 | + }, |
| 93 | + warning, |
| 94 | + //alias warn to warning |
| 95 | + warn: warning, |
| 96 | + success: { |
| 97 | + backgroundLight: colors.greenLightest, |
| 98 | + border: colors.green, |
| 99 | + iconColor: colors.greenDark, |
| 100 | + background: colors.green, |
| 101 | + }, |
| 102 | + error: { |
| 103 | + backgroundLight: colors.redLightest, |
| 104 | + border: colors.redLight, |
| 105 | + textLight: colors.redLight, |
| 106 | + iconColor: colors.red, |
| 107 | + background: colors.red, |
| 108 | + }, |
| 109 | + beta: { |
| 110 | + background: `linear-gradient(90deg, ${colors.pink}, ${colors.purple})`, |
| 111 | + }, |
| 112 | +}; |
| 113 | + |
| 114 | +const aliases = { |
| 115 | + textColor: colors.gray5, |
| 116 | + success: colors.green, |
| 117 | + error: colors.red, |
| 118 | + disabled: colors.gray1, |
| 119 | +}; |
| 120 | + |
| 121 | +const button = { |
| 122 | + borderRadius: '3px', |
| 123 | + |
| 124 | + default: { |
| 125 | + color: '#2f2936', |
| 126 | + colorActive: '#161319', |
| 127 | + background: colors.white, |
| 128 | + backgroundActive: colors.white, |
| 129 | + border: '#d8d2de', |
| 130 | + borderActive: '#c9c0d1', |
| 131 | + }, |
| 132 | + primary: { |
| 133 | + color: colors.white, |
| 134 | + background: colors.purple, |
| 135 | + backgroundActive: '#4e3fb4', |
| 136 | + border: '#3d328e', |
| 137 | + borderActive: '#352b7b', |
| 138 | + }, |
| 139 | + success: { |
| 140 | + color: colors.white, |
| 141 | + background: '#3fa372', |
| 142 | + backgroundActive: colors.green, |
| 143 | + border: '#7ccca5', |
| 144 | + borderActive: '#7ccca5', |
| 145 | + }, |
| 146 | + danger: { |
| 147 | + color: colors.white, |
| 148 | + background: colors.red, |
| 149 | + backgroundActive: '#bf2a1d', |
| 150 | + border: '#bf2a1d', |
| 151 | + borderActive: '#7d1c13', |
| 152 | + }, |
| 153 | + link: { |
| 154 | + color: colors.blue, |
| 155 | + background: 'transparent', |
| 156 | + // border: '#3d328e', |
| 157 | + backgroundActive: 'transparent', |
| 158 | + // borderActive: '#352b7b', |
| 159 | + }, |
| 160 | + disabled: { |
| 161 | + color: aliases.disabled, |
| 162 | + border: '#e3e5e6', |
| 163 | + borderActive: '#e3e5e6', |
| 164 | + background: colors.white, |
| 165 | + backgroundActive: colors.white, |
| 166 | + }, |
| 167 | +}; |
| 168 | + |
| 169 | +const theme = { |
| 170 | + breakpoints: ['768px', '992px', '1200px'], |
| 171 | + |
| 172 | + ...colors, |
74 | 173 |
|
75 | 174 | // Try to keep these ordered plz |
76 | 175 | zIndex: { |
@@ -142,123 +241,36 @@ const theme = { |
142 | 241 | lineHeightHeading: '1.15', |
143 | 242 | lineHeightBody: '1.4', |
144 | 243 | }, |
145 | | -}; |
146 | 244 |
|
147 | | -// Aliases |
148 | | -theme.textColor = theme.gray5; |
149 | | -theme.success = theme.green; |
150 | | -theme.error = theme.red; |
151 | | -theme.disabled = theme.gray1; |
| 245 | + // Aliases |
| 246 | + ...aliases, |
152 | 247 |
|
153 | | -theme.alert = { |
154 | | - muted: { |
155 | | - backgroundLight: theme.offWhite, |
156 | | - background: theme.gray1, |
157 | | - border: theme.gray6, |
158 | | - }, |
159 | | - info: { |
160 | | - backgroundLight: theme.blueLightest, |
161 | | - border: theme.blueLight, |
162 | | - iconColor: theme.blue, |
163 | | - background: theme.blue, |
164 | | - }, |
165 | | - warning: { |
166 | | - backgroundLight: theme.yellowLightest, |
167 | | - background: theme.yellowDarkest, |
168 | | - border: theme.yellowDark, |
169 | | - iconColor: theme.yellowDark, |
170 | | - }, |
171 | | - success: { |
172 | | - backgroundLight: theme.greenLightest, |
173 | | - border: theme.green, |
174 | | - iconColor: theme.greenDark, |
175 | | - background: theme.green, |
176 | | - }, |
177 | | - error: { |
178 | | - backgroundLight: theme.redLightest, |
179 | | - border: theme.redLight, |
180 | | - textLight: theme.redLight, |
181 | | - iconColor: theme.red, |
182 | | - background: theme.red, |
183 | | - }, |
184 | | - beta: { |
185 | | - background: `linear-gradient(90deg, ${theme.pink}, ${theme.purple})`, |
186 | | - }, |
187 | | -}; |
| 248 | + alert, |
| 249 | + button, |
188 | 250 |
|
189 | | -//alias warn to warning |
190 | | -theme.alert.warn = theme.alert.warning; |
| 251 | + charts: { |
| 252 | + colors: CHART_PALETTE[CHART_PALETTE.length - 1], |
191 | 253 |
|
192 | | -theme.button = { |
193 | | - borderRadius: '3px', |
| 254 | + // We have an array that maps `number + 1` --> list of `number` colors |
| 255 | + getColorPalette: (length: number) => |
| 256 | + CHART_PALETTE[Math.min(CHART_PALETTE.length - 1, length + 1)], |
194 | 257 |
|
195 | | - default: { |
196 | | - color: '#2f2936', |
197 | | - colorActive: '#161319', |
198 | | - background: theme.white, |
199 | | - backgroundActive: theme.white, |
200 | | - border: '#d8d2de', |
201 | | - borderActive: '#c9c0d1', |
| 258 | + previousPeriod: colors.gray1, |
| 259 | + symbolSize: 6, |
202 | 260 | }, |
203 | | - primary: { |
204 | | - color: theme.white, |
205 | | - background: theme.purple, |
206 | | - backgroundActive: '#4e3fb4', |
207 | | - border: '#3d328e', |
208 | | - borderActive: '#352b7b', |
209 | | - }, |
210 | | - success: { |
211 | | - color: theme.white, |
212 | | - background: '#3fa372', |
213 | | - backgroundActive: theme.green, |
214 | | - border: '#7ccca5', |
215 | | - borderActive: '#7ccca5', |
216 | | - }, |
217 | | - danger: { |
218 | | - color: theme.white, |
219 | | - background: theme.red, |
220 | | - backgroundActive: '#bf2a1d', |
221 | | - border: '#bf2a1d', |
222 | | - borderActive: '#7d1c13', |
223 | | - }, |
224 | | - link: { |
225 | | - color: theme.blue, |
226 | | - background: 'transparent', |
227 | | - // border: '#3d328e', |
228 | | - backgroundActive: 'transparent', |
229 | | - // borderActive: '#352b7b', |
230 | | - }, |
231 | | - disabled: { |
232 | | - color: theme.disabled, |
233 | | - border: '#e3e5e6', |
234 | | - borderActive: '#e3e5e6', |
235 | | - background: theme.white, |
236 | | - backgroundActive: theme.white, |
237 | | - }, |
238 | | -}; |
239 | | - |
240 | | -theme.charts = { |
241 | | - colors: CHART_PALETTE[CHART_PALETTE.length - 1], |
242 | 261 |
|
243 | | - // We have an array that maps `number + 1` --> list of `number` colors |
244 | | - getColorPalette: length => |
245 | | - CHART_PALETTE[Math.min(CHART_PALETTE.length - 1, length + 1)], |
246 | | - |
247 | | - previousPeriod: theme.gray1, |
248 | | - symbolSize: 6, |
249 | | -}; |
250 | | - |
251 | | -theme.diff = { |
252 | | - removedRow: '#fcefee', |
253 | | - addedRow: '#f5fbf8', |
254 | | - removed: '#f7ceca', |
255 | | - added: '#d8f0e4', |
256 | | -}; |
| 262 | + diff: { |
| 263 | + removedRow: '#fcefee', |
| 264 | + addedRow: '#f5fbf8', |
| 265 | + removed: '#f7ceca', |
| 266 | + added: '#d8f0e4', |
| 267 | + }, |
257 | 268 |
|
258 | | -// Similarity spectrum used in "Similar Issues" in group details |
259 | | -theme.similarity = { |
260 | | - empty: '#e2dee6', |
261 | | - colors: ['#ec5e44', '#f38259', '#f9a66d', '#98b480', '#57be8c'], |
| 269 | + // Similarity spectrum used in "Similar Issues" in group details |
| 270 | + similarity: { |
| 271 | + empty: '#e2dee6', |
| 272 | + colors: ['#ec5e44', '#f38259', '#f9a66d', '#98b480', '#57be8c'], |
| 273 | + }, |
262 | 274 | }; |
263 | 275 |
|
264 | 276 | export default theme; |
0 commit comments