Skip to content

Commit 075c0fc

Browse files
authored
Merge pull request #2249 from lindapaiste/refactor/extend-theme
Contrast theme extends dark theme
2 parents 1a3cc81 + 789ad0c commit 075c0fc

File tree

1 file changed

+14
-47
lines changed

1 file changed

+14
-47
lines changed

client/theme.js

Lines changed: 14 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ export const prop = (key) => (props) => {
6464
return value;
6565
};
6666

67-
export default {
67+
export const extend = (baseTheme, modifications) =>
68+
lodash.merge(lodash.cloneDeep(baseTheme), modifications);
69+
70+
const baseThemes = {
6871
[Theme.light]: {
6972
colors,
7073
...common,
@@ -228,35 +231,23 @@ export default {
228231
Policy: {
229232
link: colors.processingBlueLight
230233
}
231-
},
232-
[Theme.contrast]: {
233-
colors,
234-
...common,
235-
primaryTextColor: grays.lightest,
234+
}
235+
};
236+
237+
export default {
238+
...baseThemes,
239+
[Theme.contrast]: extend(baseThemes[Theme.dark], {
236240
inactiveTextColor: grays.light,
237-
backgroundColor: grays.darker,
238241

239242
Button: {
240243
primary: {
241-
default: {
242-
foreground: grays.light,
243-
background: grays.dark,
244-
border: grays.middleDark
245-
},
246244
hover: {
247245
foreground: grays.dark,
248246
background: colors.yellow,
249247
border: colors.yellow
250248
},
251249
active: {
252-
foreground: grays.dark,
253-
background: colors.p5jsActivePink,
254-
border: colors.p5jsActivePink
255-
},
256-
disabled: {
257-
foreground: grays.light,
258-
background: grays.dark,
259-
border: grays.middleDark
250+
foreground: grays.dark
260251
}
261252
},
262253
secondary: {
@@ -271,44 +262,20 @@ export default {
271262
border: colors.yellow
272263
},
273264
active: {
274-
foreground: grays.dark,
275-
background: colors.p5jsActivePink,
276-
border: colors.p5jsActivePink
277-
},
278-
disabled: {
279-
foreground: grays.light,
280-
background: grays.dark,
281-
border: grays.middleDark
265+
foreground: grays.dark
282266
}
283267
}
284268
},
285269
Icon: {
286270
default: grays.mediumLight,
287271
hover: colors.yellow
288272
},
289-
MobilePanel: {
290-
default: {
291-
foreground: grays.light,
292-
background: grays.dark,
293-
border: grays.middleDark
294-
}
295-
},
296273
Modal: {
297-
background: grays.dark,
298-
border: grays.middleDark,
299274
separator: grays.light
300275
},
301-
Separator: grays.middleDark,
302-
303276
TabHighlight: grays.darker,
304277
SketchList: {
305-
background: colors.yellow,
306-
card: {
307-
background: grays.dark
308-
}
309-
},
310-
Policy: {
311-
link: colors.processingBlueLight
278+
background: colors.yellow
312279
}
313-
}
280+
})
314281
};

0 commit comments

Comments
 (0)