1+ import lodash from 'lodash' ;
2+
13export const Theme = {
24 contrast : 'contrast' ,
35 dark : 'dark' ,
46 light : 'light' ,
57} ;
68
79export const colors = {
8- p5pink : '#ed225d' ,
10+ p5jsPink : '#ed225d' ,
11+ processingBlue : '#007BBB' ,
12+ p5jsActivePink : '#f10046' ,
13+ white : '#fff' ,
14+ black : '#000' ,
915 yellow : '#f5dc23' ,
16+ orange : '#ffa500' ,
17+ red : '#ff0000' ,
18+ lightsteelblue : '#B0C4DE' ,
19+ dodgerblue : '#1E90FF' ,
20+ p5ContrastPink : ' #FFA9D9' ,
21+
22+ borderColor : ' #B5B5B5' ,
23+ outlineColor : '#0F9DD7' ,
24+ } ;
25+
26+ export const grays = {
27+ lightest : '#FFF' , // primary
28+ lighter : '#FBFBFB' ,
29+
30+ light : '#F0F0F0' , // primary
31+ mediumLight : '#D9D9D9' ,
32+ middleLight : '#A6A6A6' ,
33+
34+ middleGray : '#747474' , // primary
35+ middleDark : '#666' ,
36+ mediumDark : '#4D4D4D' ,
37+
38+ dark : '#333' , // primary
39+ darker : '#1C1C1C' ,
40+ darkest : '#000' ,
1041} ;
1142
1243export const common = {
@@ -16,7 +47,8 @@ export const common = {
1647export const remSize = size => `${ size / common . baseFontSize } rem` ;
1748
1849export const prop = key => ( props ) => {
19- const value = props . theme [ key ] ;
50+ const keypath = `theme.${ key } ` ;
51+ const value = lodash . get ( props , keypath ) ;
2052
2153 if ( value == null ) {
2254 throw new Error ( `themed prop ${ key } not found` ) ;
@@ -29,40 +61,85 @@ export default {
2961 [ Theme . light ] : {
3062 colors,
3163 ...common ,
32- primaryTextColor : '#333' ,
33-
34- buttonColor : '#000' ,
35- buttonColorBackground : '#f4f4f4' ,
36- buttonBorderColor : '#b5b5b5' ,
37- buttonHoverColor : '#fff' ,
38- buttonHoverColorBackground : colors . p5pink ,
39- buttonDisabledColor : '#f10046' ,
40- buttonDisabledColorBackground : '#fff' ,
64+ primaryTextColor : grays . dark ,
65+
66+ Button : {
67+ default : {
68+ foreground : colors . black ,
69+ background : grays . light ,
70+ border : grays . middleLight ,
71+ } ,
72+ hover : {
73+ foreground : grays . lightest ,
74+ background : colors . p5jsPink ,
75+ border : colors . p5jsPink ,
76+ } ,
77+ active : {
78+ foreground : grays . lightest ,
79+ background : colors . p5jsActivePink ,
80+ border : colors . p5jsActivePink ,
81+ } ,
82+ disabled : {
83+ foreground : colors . black ,
84+ background : grays . light ,
85+ border : grays . middleLight ,
86+ } ,
87+ } ,
4188 } ,
4289 [ Theme . dark ] : {
4390 colors,
4491 ...common ,
45- primaryTextColor : '#FFF' ,
46-
47- buttonColor : '#000' ,
48- buttonColorBackground : '#f4f4f4' ,
49- buttonBorderColor : '#b5b5b5' ,
50- buttonHoverColor : '#fff' ,
51- buttonHoverColorBackground : colors . p5pink ,
52- buttonDisabledColor : '#f10046' ,
53- buttonDisabledColorBackground : '#fff' ,
92+ primaryTextColor : grays . lightest ,
93+
94+ Button : {
95+ default : {
96+ foreground : grays . light ,
97+ background : grays . dark ,
98+ border : grays . middleDark ,
99+ } ,
100+ hover : {
101+ foreground : grays . lightest ,
102+ background : colors . p5jsPink ,
103+ border : colors . p5jsPink ,
104+ } ,
105+ active : {
106+ foreground : grays . lightest ,
107+ background : colors . p5jsActivePink ,
108+ border : colors . p5jsActivePink ,
109+ } ,
110+ disabled : {
111+ foreground : grays . light ,
112+ background : grays . dark ,
113+ border : grays . middleDark ,
114+ } ,
115+ } ,
54116 } ,
55117 [ Theme . contrast ] : {
56118 colors,
57119 ...common ,
58- primaryTextColor : '#F5DC23' ,
59-
60- buttonColor : '#000' ,
61- buttonColorBackground : colors . yellow ,
62- buttonBorderColor : '#b5b5b5' ,
63- buttonHoverColor : '#333' ,
64- buttonHoverColorBackground : '#fff' ,
65- buttonDisabledColor : '#333' ,
66- buttonDisabledColorBackground : colors . yellow ,
120+ primaryTextColor : grays . lightest ,
121+
122+ Button : {
123+ default : {
124+ foreground : grays . light ,
125+ background : grays . dark ,
126+ border : grays . middleDark ,
127+ } ,
128+ hover : {
129+ foreground : grays . dark ,
130+ background : colors . yellow ,
131+ border : colors . yellow ,
132+ } ,
133+ active : {
134+ foreground : grays . dark ,
135+ background : colors . p5jsActivePink ,
136+ border : colors . p5jsActivePink ,
137+ } ,
138+ disabled : {
139+ foreground : grays . light ,
140+ background : grays . dark ,
141+ border : grays . middleDark ,
142+ } ,
143+ } ,
67144 } ,
68145} ;
0 commit comments