2020-05-03 09:54:57 +00:00
|
|
|
import lodash from 'lodash';
|
|
|
|
|
2020-01-19 21:05:16 +00:00
|
|
|
export const Theme = {
|
|
|
|
contrast: 'contrast',
|
|
|
|
dark: 'dark',
|
|
|
|
light: 'light',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const colors = {
|
2020-05-03 09:54:57 +00:00
|
|
|
p5jsPink: '#ed225d',
|
|
|
|
processingBlue: '#007BBB',
|
|
|
|
p5jsActivePink: '#f10046',
|
|
|
|
white: '#fff',
|
|
|
|
black: '#000',
|
2020-01-19 21:05:16 +00:00
|
|
|
yellow: '#f5dc23',
|
2020-05-03 09:54:57 +00:00
|
|
|
orange: '#ffa500',
|
|
|
|
red: '#ff0000',
|
|
|
|
lightsteelblue: '#B0C4DE',
|
|
|
|
dodgerblue: '#1E90FF',
|
|
|
|
p5ContrastPink: ' #FFA9D9',
|
|
|
|
|
|
|
|
borderColor: ' #B5B5B5',
|
|
|
|
outlineColor: '#0F9DD7',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const grays = {
|
|
|
|
lightest: '#FFF', // primary
|
|
|
|
lighter: '#FBFBFB',
|
|
|
|
|
|
|
|
light: '#F0F0F0', // primary
|
|
|
|
mediumLight: '#D9D9D9',
|
|
|
|
middleLight: '#A6A6A6',
|
|
|
|
|
|
|
|
middleGray: '#747474', // primary
|
|
|
|
middleDark: '#666',
|
|
|
|
mediumDark: '#4D4D4D',
|
|
|
|
|
|
|
|
dark: '#333', // primary
|
|
|
|
darker: '#1C1C1C',
|
|
|
|
darkest: '#000',
|
2020-01-19 21:05:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export const common = {
|
2020-07-22 18:37:44 +00:00
|
|
|
baseFontSize: 12,
|
|
|
|
shadowColor: 'rgba(0, 0, 0, 0.16)'
|
2020-01-19 21:05:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export const remSize = size => `${size / common.baseFontSize}rem`;
|
|
|
|
|
2020-04-19 18:29:17 +00:00
|
|
|
export const prop = key => (props) => {
|
2020-05-03 09:54:57 +00:00
|
|
|
const keypath = `theme.${key}`;
|
|
|
|
const value = lodash.get(props, keypath);
|
2020-04-19 18:29:17 +00:00
|
|
|
|
|
|
|
if (value == null) {
|
|
|
|
throw new Error(`themed prop ${key} not found`);
|
|
|
|
}
|
|
|
|
|
|
|
|
return value;
|
|
|
|
};
|
2020-01-19 21:05:16 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
[Theme.light]: {
|
|
|
|
colors,
|
|
|
|
...common,
|
2020-05-03 09:54:57 +00:00
|
|
|
primaryTextColor: grays.dark,
|
|
|
|
|
|
|
|
Button: {
|
|
|
|
default: {
|
|
|
|
foreground: colors.black,
|
|
|
|
background: grays.light,
|
|
|
|
border: grays.middleLight,
|
|
|
|
},
|
|
|
|
hover: {
|
|
|
|
foreground: grays.lightest,
|
|
|
|
background: colors.p5jsPink,
|
|
|
|
border: colors.p5jsPink,
|
|
|
|
},
|
|
|
|
active: {
|
|
|
|
foreground: grays.lightest,
|
|
|
|
background: colors.p5jsActivePink,
|
|
|
|
border: colors.p5jsActivePink,
|
|
|
|
},
|
|
|
|
disabled: {
|
|
|
|
foreground: colors.black,
|
|
|
|
background: grays.light,
|
|
|
|
border: grays.middleLight,
|
|
|
|
},
|
|
|
|
},
|
2020-06-18 19:34:28 +00:00
|
|
|
Icon: {
|
|
|
|
default: grays.middleGray,
|
|
|
|
hover: grays.darker
|
2020-06-29 21:13:42 +00:00
|
|
|
},
|
2020-07-01 18:36:17 +00:00
|
|
|
MobilePanel: {
|
2020-06-29 21:13:42 +00:00
|
|
|
default: {
|
|
|
|
foreground: colors.black,
|
|
|
|
background: grays.light,
|
|
|
|
border: grays.middleLight,
|
|
|
|
},
|
2020-07-22 18:37:44 +00:00
|
|
|
},
|
|
|
|
Modal: {
|
|
|
|
background: grays.light,
|
|
|
|
border: grays.middleLight
|
2020-06-18 19:34:28 +00:00
|
|
|
}
|
2020-01-19 21:05:16 +00:00
|
|
|
},
|
|
|
|
[Theme.dark]: {
|
|
|
|
colors,
|
|
|
|
...common,
|
2020-05-03 09:54:57 +00:00
|
|
|
primaryTextColor: grays.lightest,
|
|
|
|
|
|
|
|
Button: {
|
|
|
|
default: {
|
|
|
|
foreground: grays.light,
|
|
|
|
background: grays.dark,
|
|
|
|
border: grays.middleDark,
|
|
|
|
},
|
|
|
|
hover: {
|
|
|
|
foreground: grays.lightest,
|
|
|
|
background: colors.p5jsPink,
|
|
|
|
border: colors.p5jsPink,
|
|
|
|
},
|
|
|
|
active: {
|
|
|
|
foreground: grays.lightest,
|
|
|
|
background: colors.p5jsActivePink,
|
|
|
|
border: colors.p5jsActivePink,
|
|
|
|
},
|
|
|
|
disabled: {
|
|
|
|
foreground: grays.light,
|
|
|
|
background: grays.dark,
|
|
|
|
border: grays.middleDark,
|
|
|
|
},
|
|
|
|
},
|
2020-06-18 19:34:28 +00:00
|
|
|
Icon: {
|
|
|
|
default: grays.middleLight,
|
|
|
|
hover: grays.lightest
|
2020-06-29 21:13:42 +00:00
|
|
|
},
|
2020-07-01 18:36:17 +00:00
|
|
|
MobilePanel: {
|
2020-06-29 21:13:42 +00:00
|
|
|
default: {
|
|
|
|
foreground: grays.light,
|
|
|
|
background: grays.dark,
|
|
|
|
border: grays.middleDark,
|
|
|
|
},
|
2020-07-22 18:37:44 +00:00
|
|
|
},
|
|
|
|
Modal: {
|
|
|
|
background: grays.dark,
|
|
|
|
border: grays.middleDark
|
2020-06-18 19:34:28 +00:00
|
|
|
}
|
2020-01-19 21:05:16 +00:00
|
|
|
},
|
|
|
|
[Theme.contrast]: {
|
|
|
|
colors,
|
|
|
|
...common,
|
2020-05-03 09:54:57 +00:00
|
|
|
primaryTextColor: grays.lightest,
|
|
|
|
|
|
|
|
Button: {
|
|
|
|
default: {
|
|
|
|
foreground: grays.light,
|
|
|
|
background: grays.dark,
|
|
|
|
border: grays.middleDark,
|
|
|
|
},
|
|
|
|
hover: {
|
|
|
|
foreground: grays.dark,
|
|
|
|
background: colors.yellow,
|
|
|
|
border: colors.yellow,
|
|
|
|
},
|
|
|
|
active: {
|
|
|
|
foreground: grays.dark,
|
|
|
|
background: colors.p5jsActivePink,
|
|
|
|
border: colors.p5jsActivePink,
|
|
|
|
},
|
|
|
|
disabled: {
|
|
|
|
foreground: grays.light,
|
|
|
|
background: grays.dark,
|
|
|
|
border: grays.middleDark,
|
|
|
|
},
|
|
|
|
},
|
2020-06-18 19:34:28 +00:00
|
|
|
Icon: {
|
|
|
|
default: grays.mediumLight,
|
|
|
|
hover: colors.yellow
|
2020-06-29 21:13:42 +00:00
|
|
|
},
|
2020-07-01 18:36:17 +00:00
|
|
|
MobilePanel: {
|
2020-06-29 21:13:42 +00:00
|
|
|
default: {
|
|
|
|
foreground: grays.light,
|
|
|
|
background: grays.dark,
|
|
|
|
border: grays.middleDark,
|
|
|
|
},
|
2020-07-22 18:37:44 +00:00
|
|
|
},
|
|
|
|
Modal: {
|
|
|
|
background: grays.dark,
|
|
|
|
border: grays.middleDark
|
2020-06-18 19:34:28 +00:00
|
|
|
}
|
2020-01-19 21:05:16 +00:00
|
|
|
},
|
|
|
|
};
|