diff options
Diffstat (limited to 'packages/theme/src')
-rw-r--r-- | packages/theme/src/index.ts | 18 | ||||
-rw-r--r-- | packages/theme/src/themes/dark/index.ts | 120 | ||||
-rw-r--r-- | packages/theme/src/themes/default/index.ts | 209 | ||||
-rw-r--r-- | packages/theme/src/themes/legacy/index.ts | 38 |
4 files changed, 385 insertions, 0 deletions
diff --git a/packages/theme/src/index.ts b/packages/theme/src/index.ts new file mode 100644 index 000000000..524a9edf1 --- /dev/null +++ b/packages/theme/src/index.ts | |||
@@ -0,0 +1,18 @@ | |||
1 | import * as darkThemeConfig from './themes/dark'; | ||
2 | import * as defaultThemeConfig from './themes/default'; | ||
3 | import * as legacyStyles from './themes/legacy'; | ||
4 | |||
5 | export enum ThemeType { | ||
6 | default = 'default', | ||
7 | dark = 'dark', | ||
8 | } | ||
9 | |||
10 | export function theme(themeId: ThemeType) { | ||
11 | if (themeId === ThemeType.dark) { | ||
12 | return Object.assign({}, defaultThemeConfig, darkThemeConfig, { legacyStyles }); | ||
13 | } | ||
14 | |||
15 | return Object.assign({}, defaultThemeConfig, { legacyStyles }); | ||
16 | } | ||
17 | |||
18 | export type Theme = typeof defaultThemeConfig; | ||
diff --git a/packages/theme/src/themes/dark/index.ts b/packages/theme/src/themes/dark/index.ts new file mode 100644 index 000000000..d48dbf916 --- /dev/null +++ b/packages/theme/src/themes/dark/index.ts | |||
@@ -0,0 +1,120 @@ | |||
1 | import color from 'color'; | ||
2 | import { cloneDeep, merge } from 'lodash'; | ||
3 | |||
4 | import * as defaultStyles from '../default'; | ||
5 | import * as legacyStyles from '../legacy'; | ||
6 | |||
7 | export const colorBackground = legacyStyles.darkThemeGrayDarkest; | ||
8 | export const colorContentBackground = legacyStyles.darkThemeGrayDarkest; | ||
9 | export const colorBackgroundSubscriptionContainer = legacyStyles.themeBrandInfo; | ||
10 | |||
11 | export const colorHeadline = legacyStyles.darkThemeTextColor; | ||
12 | export const colorText = legacyStyles.darkThemeTextColor; | ||
13 | |||
14 | // Loader | ||
15 | export const colorFullscreenLoaderSpinner = '#FFF'; | ||
16 | export const colorWebviewLoaderBackground = color(legacyStyles.darkThemeGrayDarkest).alpha(0.5).rgb().string(); | ||
17 | |||
18 | // Input | ||
19 | export const labelColor = legacyStyles.darkThemeTextColor; | ||
20 | export const inputColor = legacyStyles.darkThemeGrayLightest; | ||
21 | export const inputBackground = legacyStyles.themeGrayDark; | ||
22 | export const inputBorder = `1px solid ${legacyStyles.darkThemeGrayLight}`; | ||
23 | export const inputPrefixColor = color(legacyStyles.darkThemeGrayLighter).lighten(0.3).hex(); | ||
24 | export const inputPrefixBackground = legacyStyles.darkThemeGray; | ||
25 | export const inputDisabledOpacity = 0.5; | ||
26 | export const inputScorePasswordBackground = legacyStyles.darkThemeGrayDark; | ||
27 | export const inputModifierColor = color(legacyStyles.darkThemeGrayLighter).lighten(0.3).hex(); | ||
28 | export const inputPlaceholderColor = color(legacyStyles.darkThemeGrayLighter).darken(0.1).hex(); | ||
29 | |||
30 | // Toggle | ||
31 | export const toggleBackground = legacyStyles.darkThemeGray; | ||
32 | export const toggleButton = legacyStyles.darkThemeGrayLighter; | ||
33 | |||
34 | // Button | ||
35 | export const buttonPrimaryTextColor = legacyStyles.darkThemeTextColor; | ||
36 | |||
37 | export const buttonSecondaryBackground = legacyStyles.darkThemeGrayLighter; | ||
38 | export const buttonSecondaryTextColor = legacyStyles.darkThemeTextColor; | ||
39 | |||
40 | export const buttonDangerTextColor = legacyStyles.darkThemeTextColor; | ||
41 | |||
42 | export const buttonWarningTextColor = legacyStyles.darkThemeTextColor; | ||
43 | |||
44 | export const buttonLoaderColor = { | ||
45 | primary: '#FFF', | ||
46 | secondary: buttonSecondaryTextColor, | ||
47 | success: '#FFF', | ||
48 | warning: '#FFF', | ||
49 | danger: '#FFF', | ||
50 | inverted: defaultStyles.brandPrimary, | ||
51 | }; | ||
52 | |||
53 | // Select | ||
54 | export const selectBackground = inputBackground; | ||
55 | export const selectBorder = inputBorder; | ||
56 | export const selectColor = inputColor; | ||
57 | export const selectToggleColor = inputPrefixColor; | ||
58 | export const selectPopupBackground = legacyStyles.darkThemeGrayLight; | ||
59 | export const selectOptionColor = '#FFF'; | ||
60 | export const selectOptionBorder = `1px solid ${color(legacyStyles.darkThemeGrayLight).darken(0.2).hex()}`; | ||
61 | export const selectOptionItemHover = color(legacyStyles.darkThemeGrayLight).darken(0.2).hex(); | ||
62 | export const selectOptionItemHoverColor = selectColor; | ||
63 | export const selectSearchColor = inputBackground; | ||
64 | |||
65 | // Modal | ||
66 | export const colorModalOverlayBackground = color(legacyStyles.darkThemeBlack).alpha(0.8).rgb().string(); | ||
67 | |||
68 | // Services | ||
69 | export const services = merge({}, defaultStyles.services, { | ||
70 | listItems: { | ||
71 | borderColor: legacyStyles.darkThemeGrayDarker, | ||
72 | hoverBgColor: legacyStyles.darkThemeGrayDarker, | ||
73 | disabled: { | ||
74 | color: legacyStyles.darkThemeGray, | ||
75 | }, | ||
76 | }, | ||
77 | }); | ||
78 | |||
79 | // Service Icon | ||
80 | export const serviceIcon = merge({}, defaultStyles.serviceIcon, { | ||
81 | isCustom: { | ||
82 | border: `1px solid ${legacyStyles.darkThemeGrayDark}`, | ||
83 | }, | ||
84 | }); | ||
85 | |||
86 | // Workspaces | ||
87 | const drawerBg = color(colorBackground).lighten(0.3).hex(); | ||
88 | |||
89 | export const workspaces = merge({}, defaultStyles.workspaces, { | ||
90 | settings: { | ||
91 | listItems: cloneDeep(services.listItems), | ||
92 | }, | ||
93 | drawer: { | ||
94 | background: drawerBg, | ||
95 | addButton: { | ||
96 | color: legacyStyles.darkThemeGrayLighter, | ||
97 | hoverColor: legacyStyles.darkThemeGraySmoke, | ||
98 | }, | ||
99 | listItem: { | ||
100 | border: color(drawerBg).lighten(0.2).hex(), | ||
101 | hoverBackground: color(drawerBg).lighten(0.2).hex(), | ||
102 | activeBackground: defaultStyles.brandPrimary, | ||
103 | name: { | ||
104 | color: colorText, | ||
105 | activeColor: 'white', | ||
106 | }, | ||
107 | services: { | ||
108 | color: color(colorText).darken(0.5).hex(), | ||
109 | active: color(defaultStyles.brandPrimary).lighten(0.5).hex(), | ||
110 | }, | ||
111 | }, | ||
112 | }, | ||
113 | }); | ||
114 | |||
115 | // Announcements | ||
116 | export const announcements = merge({}, defaultStyles.workspaces, { | ||
117 | spotlight: { | ||
118 | background: legacyStyles.darkThemeGrayDark, | ||
119 | }, | ||
120 | }); | ||
diff --git a/packages/theme/src/themes/default/index.ts b/packages/theme/src/themes/default/index.ts new file mode 100644 index 000000000..0f02fa3c8 --- /dev/null +++ b/packages/theme/src/themes/default/index.ts | |||
@@ -0,0 +1,209 @@ | |||
1 | import color from 'color'; | ||
2 | import { cloneDeep } from 'lodash'; | ||
3 | |||
4 | import * as legacyStyles from '../legacy'; | ||
5 | |||
6 | export interface IStyleTypes { | ||
7 | [index: string]: { | ||
8 | accent: string; | ||
9 | contrast: string; | ||
10 | border?: string; | ||
11 | }; | ||
12 | } | ||
13 | |||
14 | export const brandPrimary = '#3498db'; | ||
15 | export const brandSuccess = '#5cb85c'; | ||
16 | export const brandInfo = '#5bc0de'; | ||
17 | export const brandWarning = '#FF9F00'; | ||
18 | export const brandDanger = '#d9534f'; | ||
19 | |||
20 | export const uiFontSize = 14; | ||
21 | |||
22 | export const borderRadius = legacyStyles.themeBorderRadius; | ||
23 | export const borderRadiusSmall = legacyStyles.themeBorderRadiusSmall; | ||
24 | |||
25 | export const colorBackground = legacyStyles.themeGrayLighter; | ||
26 | export const colorContentBackground = '#FFFFFF'; | ||
27 | export const colorHeadline = legacyStyles.themeGrayDark; | ||
28 | |||
29 | export const colorText = legacyStyles.themeTextColor; | ||
30 | |||
31 | // Subscription Container Component | ||
32 | export const colorSubscriptionContainerBackground = 'none'; | ||
33 | export const colorSubscriptionContainerBorder = `1px solid ${brandPrimary}`; | ||
34 | export const colorSubscriptionContainerTitle = brandPrimary; | ||
35 | export const colorSubscriptionContainerActionButtonBackground = brandPrimary; | ||
36 | export const colorSubscriptionContainerActionButtonColor = '#FFF'; | ||
37 | |||
38 | // Loader | ||
39 | export const colorAppLoaderSpinner = '#FFF'; | ||
40 | export const colorFullscreenLoaderSpinner = legacyStyles.themeGrayDark; | ||
41 | export const colorWebviewLoaderBackground = color(legacyStyles.themeGrayLighter).alpha(0.8).rgb().string(); | ||
42 | |||
43 | // Input | ||
44 | export const labelColor = legacyStyles.themeGrayLight; | ||
45 | export const inputColor = legacyStyles.themeGray; | ||
46 | export const inputHeight = 40; | ||
47 | export const inputBackground = legacyStyles.themeGrayLightest; | ||
48 | export const inputBorder = `1px solid ${legacyStyles.themeGrayLighter}`; | ||
49 | export const inputModifierColor = legacyStyles.themeGrayLight; | ||
50 | export const inputPlaceholderColor = color(legacyStyles.themeGrayLight).lighten(0.3).hex(); | ||
51 | export const inputPrefixColor = legacyStyles.themeGrayLight; | ||
52 | export const inputPrefixBackground = legacyStyles.themeGrayLighter; | ||
53 | export const inputDisabledOpacity = 0.5; | ||
54 | export const inputScorePasswordBackground = legacyStyles.themeGrayLighter; | ||
55 | |||
56 | // Toggle | ||
57 | export const toggleBackground = legacyStyles.themeGrayLighter; | ||
58 | export const toggleButton = legacyStyles.themeGrayLight; | ||
59 | export const toggleButtonActive = brandPrimary; | ||
60 | export const toggleWidth = 40; | ||
61 | export const toggleHeight = 14; | ||
62 | |||
63 | // Style Types | ||
64 | export const styleTypes: IStyleTypes = { | ||
65 | primary: { | ||
66 | accent: brandPrimary, | ||
67 | contrast: '#FFF', | ||
68 | }, | ||
69 | secondary: { | ||
70 | accent: legacyStyles.themeGrayLighter, | ||
71 | contrast: legacyStyles.themeGray, | ||
72 | }, | ||
73 | success: { | ||
74 | accent: brandSuccess, | ||
75 | contrast: '#FFF', | ||
76 | }, | ||
77 | warning: { | ||
78 | accent: brandWarning, | ||
79 | contrast: '#FFF', | ||
80 | }, | ||
81 | danger: { | ||
82 | accent: brandDanger, | ||
83 | contrast: '#FFF', | ||
84 | }, | ||
85 | inverted: { | ||
86 | accent: 'none', | ||
87 | contrast: brandPrimary, | ||
88 | border: `1px solid ${brandPrimary}`, | ||
89 | }, | ||
90 | }; | ||
91 | |||
92 | // Button | ||
93 | export const buttonPrimaryBackground = brandPrimary; | ||
94 | export const buttonPrimaryTextColor = '#FFF'; | ||
95 | |||
96 | export const buttonSecondaryBackground = legacyStyles.themeGrayLighter; | ||
97 | export const buttonSecondaryTextColor = legacyStyles.themeGray; | ||
98 | |||
99 | export const buttonSuccessBackground = brandSuccess; | ||
100 | export const buttonSuccessTextColor = '#FFF'; | ||
101 | |||
102 | export const buttonDangerBackground = brandDanger; | ||
103 | export const buttonDangerTextColor = '#FFF'; | ||
104 | |||
105 | export const buttonWarningBackground = brandWarning; | ||
106 | export const buttonWarningTextColor = '#FFF'; | ||
107 | |||
108 | export const buttonInvertedBackground = 'none'; | ||
109 | export const buttonInvertedTextColor = brandPrimary; | ||
110 | export const buttonInvertedBorder = `1px solid ${brandPrimary}`; | ||
111 | |||
112 | export const buttonHeight = inputHeight; | ||
113 | |||
114 | export const buttonLoaderColor = { | ||
115 | primary: '#FFF', | ||
116 | secondary: buttonSecondaryTextColor, | ||
117 | success: '#FFF', | ||
118 | warning: '#FFF', | ||
119 | danger: '#FFF', | ||
120 | inverted: brandPrimary, | ||
121 | }; | ||
122 | |||
123 | // Select | ||
124 | export const selectBackground = inputBackground; | ||
125 | export const selectBorder = inputBorder; | ||
126 | export const selectHeight = inputHeight; | ||
127 | export const selectColor = inputColor; | ||
128 | export const selectToggleColor = inputPrefixColor; | ||
129 | export const selectPopupBackground = '#FFF'; | ||
130 | export const selectOptionColor = inputColor; | ||
131 | export const selectOptionBorder = `1px solid ${legacyStyles.themeGrayLightest}`; | ||
132 | export const selectOptionItemHover = legacyStyles.themeGrayLighter; | ||
133 | export const selectOptionItemHoverColor = selectColor; | ||
134 | export const selectOptionItemActive = brandPrimary; | ||
135 | export const selectOptionItemActiveColor = '#FFF'; | ||
136 | export const selectSearchBackground = legacyStyles.themeGrayLighter; | ||
137 | export const selectSearchColor = inputColor; | ||
138 | export const selectDisabledOpacity = inputDisabledOpacity; | ||
139 | |||
140 | // Badge | ||
141 | export const badgeFontSize = uiFontSize - 2; | ||
142 | export const badgeBorderRadius = 50; | ||
143 | |||
144 | // Modal | ||
145 | export const colorModalOverlayBackground = color('#000').alpha(0.5).rgb().string(); | ||
146 | |||
147 | // Services | ||
148 | export const services = { | ||
149 | listItems: { | ||
150 | padding: 10, | ||
151 | height: 57, | ||
152 | borderColor: legacyStyles.themeGrayLightest, | ||
153 | hoverBgColor: legacyStyles.themeGrayLightest, | ||
154 | disabled: { | ||
155 | color: legacyStyles.themeGrayLight, | ||
156 | }, | ||
157 | }, | ||
158 | }; | ||
159 | |||
160 | // Service Icon | ||
161 | export const serviceIcon = { | ||
162 | width: 35, | ||
163 | isCustom: { | ||
164 | border: `1px solid ${legacyStyles.themeGrayLighter}`, | ||
165 | borderRadius: legacyStyles.themeBorderRadius, | ||
166 | width: 37, | ||
167 | }, | ||
168 | }; | ||
169 | |||
170 | // Workspaces | ||
171 | const drawerBg = color(colorBackground).lighten(0.1).hex(); | ||
172 | |||
173 | export const workspaces = { | ||
174 | settings: { | ||
175 | listItems: cloneDeep(services.listItems), | ||
176 | }, | ||
177 | drawer: { | ||
178 | width: 300, | ||
179 | padding: 20, | ||
180 | background: drawerBg, | ||
181 | buttons: { | ||
182 | color: color(legacyStyles.themeGrayLight).lighten(0.1).hex(), | ||
183 | hoverColor: legacyStyles.themeGrayLight, | ||
184 | }, | ||
185 | listItem: { | ||
186 | hoverBackground: color(drawerBg).darken(0.01).hex(), | ||
187 | activeBackground: legacyStyles.themeGrayLightest, | ||
188 | border: color(drawerBg).darken(0.05).hex(), | ||
189 | name: { | ||
190 | color: colorText, | ||
191 | activeColor: colorText, | ||
192 | }, | ||
193 | services: { | ||
194 | color: color(colorText).lighten(1.5).hex(), | ||
195 | active: color(colorText).lighten(1.5).hex(), | ||
196 | }, | ||
197 | }, | ||
198 | }, | ||
199 | switchingIndicator: { | ||
200 | spinnerColor: 'white', | ||
201 | }, | ||
202 | }; | ||
203 | |||
204 | // Announcements | ||
205 | export const announcements = { | ||
206 | spotlight: { | ||
207 | background: legacyStyles.themeGrayLightest, | ||
208 | }, | ||
209 | }; | ||
diff --git a/packages/theme/src/themes/legacy/index.ts b/packages/theme/src/themes/legacy/index.ts new file mode 100644 index 000000000..2114b92c1 --- /dev/null +++ b/packages/theme/src/themes/legacy/index.ts | |||
@@ -0,0 +1,38 @@ | |||
1 | /* legacy config, injected into sass */ | ||
2 | export const themeBrandPrimary = '#3498db'; | ||
3 | export const themeBrandSuccess = '#5cb85c'; | ||
4 | export const themeBrandInfo = '#5bc0de'; | ||
5 | export const themeBrandWarning = '#FF9F00'; | ||
6 | export const themeBrandDanger = '#d9534f'; | ||
7 | |||
8 | export const themeGrayDark = '#373a3c'; | ||
9 | export const themeGray = '#55595c'; | ||
10 | export const themeGrayLight = '#818a91'; | ||
11 | export const themeGrayLighter = '#eceeef'; | ||
12 | export const themeGrayLightest = '#f7f7f9'; | ||
13 | |||
14 | export const themeBorderRadius = '6px'; | ||
15 | export const themeBorderRadiusSmall = '3px'; | ||
16 | |||
17 | export const themeSidebarWidth = '68px'; | ||
18 | |||
19 | export const themeTextColor = themeGrayDark; | ||
20 | |||
21 | export const themeTransitionTime = '.5s'; | ||
22 | |||
23 | export const themeInsetShadow = 'inset 0 2px 5px rgba(0, 0, 0, .03)'; | ||
24 | |||
25 | export const darkThemeBlack = '#1A1A1A'; | ||
26 | |||
27 | export const darkThemeGrayDarkest = '#1E1E1E'; | ||
28 | export const darkThemeGrayDarker = '#2D2F31'; | ||
29 | export const darkThemeGrayDark = '#383A3B'; | ||
30 | |||
31 | export const darkThemeGray = '#47494B'; | ||
32 | |||
33 | export const darkThemeGrayLight = '#515355'; | ||
34 | export const darkThemeGrayLighter = '#8a8b8b'; | ||
35 | export const darkThemeGrayLightest = '#FFFFFF'; | ||
36 | |||
37 | export const darkThemeGraySmoke = '#CED0D1'; | ||
38 | export const darkThemeTextColor = '#FFFFFF'; | ||