aboutsummaryrefslogtreecommitdiffstats
path: root/packages/theme/src/themes/default/index.ts
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2021-05-12 18:48:40 +0200
committerLibravatar GitHub <noreply@github.com>2021-05-12 18:48:40 +0200
commit2a2f6fe945b87f50c95a31efb7c47c664e58a8bf (patch)
treef38165789e3a68b83a91b6882d75885c47579371 /packages/theme/src/themes/default/index.ts
parentUpdated the documentation (#1394) (diff)
downloadferdium-app-2a2f6fe945b87f50c95a31efb7c47c664e58a8bf.tar.gz
ferdium-app-2a2f6fe945b87f50c95a31efb7c47c664e58a8bf.tar.zst
ferdium-app-2a2f6fe945b87f50c95a31efb7c47c664e58a8bf.zip
Fix some appearance issues (#1398)
* Fix property spelling in Sidebar component * Fix typo in todos partition name * Use the FerdiDev setting.json in dev mode The app.setPath calls are still a mess and need to be fixed, but this at least allows me to experiment locally. * Make @meetfranz/theme follow the accent color We inject the value of the accent color into the themes, so the buttons show the appropriate color. This allows removing some existing css hacks. In order to do this, the themes had to be turned into functions that take the brand color (accent color) as an argument instead of hard-coding it. The css-based accent color for legacy components is left unchanged. * Remove superfluous scrollbars While overflow: scroll doesn't look ugly on macs, because the system hides scrollbars by default (except on hower), on Linux and Windows, the disabled scrollbars appearing by default look ugly. We set overflow-y: auto instead to display a scrollbar only when needed. * Simplify theme generation in @meetfranz/themes * Remove default accent color code duplication * Apply accent color to styles not in themeInfo.json Some colors are darkened/lightened versions of the primary brand color, so they are not caught by build-theme-info. We create these styles with `color` manually. * Inset shadow on sidebar This creates a more flat look that projecting a shadow over the service, and avoid compositing a shadow over the webview. * Apply accent color to vertical style tab bar * Workspace drawer styling in vertical mode * Fix sidebar layout In vertical mode, the top of the service was clipped by the sidebar Also removes unnecessary whitespace in sidebar * Fix 1px wide line on right when todos are hidden * Fix window menu When building the menu bar, the File / app menu is added later, so we must be careful about indexing the menu bar. * Update locale files * Report the default accent color accurately * Fix inverted button with dark theme * Fix crash with invalid accent color Fall back to the default accent color instead * Darker secondary buttons in dark mode * Vertical workspace drawer style outside debug mode In order to reliably apply the style, we need to add a class name to the drawer manually, as component names only appear in class names in debug mode.
Diffstat (limited to 'packages/theme/src/themes/default/index.ts')
-rw-r--r--packages/theme/src/themes/default/index.ts478
1 files changed, 249 insertions, 229 deletions
diff --git a/packages/theme/src/themes/default/index.ts b/packages/theme/src/themes/default/index.ts
index 8e5e93b2a..cceb321c9 100644
--- a/packages/theme/src/themes/default/index.ts
+++ b/packages/theme/src/themes/default/index.ts
@@ -2,250 +2,270 @@ import color from 'color';
2import { cloneDeep } from 'lodash'; 2import { cloneDeep } from 'lodash';
3 3
4import * as legacyStyles from '../legacy'; 4import * as legacyStyles from '../legacy';
5 5import IStyleTypes from '../IStyleTypes';
6export interface IStyleTypes { 6
7 [index: string]: { 7export default (brandPrimary: string) => {
8 accent: string; 8 const brandSuccess = '#5cb85c';
9 contrast: string; 9 const brandInfo = '#5bc0de';
10 border?: string; 10 const brandWarning = '#FF9F00';
11 const brandDanger = '#d9534f';
12 const uiFontSize = 14;
13 const colorBackground = legacyStyles.themeGrayLighter;
14 const colorContentBackground = '#FFFFFF';
15 const colorText = legacyStyles.themeTextColor;
16 const inputColor = legacyStyles.themeGray;
17 const inputBackground = legacyStyles.themeGrayLightest;
18 const inputHeight = 40;
19 const inputBorder = `1px solid ${legacyStyles.themeGrayLighter}`;
20 const inputPrefixColor = legacyStyles.themeGrayLight;
21 const inputDisabledOpacity = 0.5;
22 const buttonSecondaryTextColor = legacyStyles.themeGray;
23 const selectColor = inputColor;
24 const drawerBg = color(colorBackground).lighten(0.1).hex();
25
26 const styleTypes: IStyleTypes = {
27 primary: {
28 accent: brandPrimary,
29 contrast: '#FFF',
30 },
31 secondary: {
32 accent: legacyStyles.themeGrayLighter,
33 contrast: legacyStyles.themeGray,
34 },
35 success: {
36 accent: brandSuccess,
37 contrast: '#FFF',
38 },
39 warning: {
40 accent: brandWarning,
41 contrast: '#FFF',
42 },
43 danger: {
44 accent: brandDanger,
45 contrast: '#FFF',
46 },
47 inverted: {
48 accent: 'none',
49 contrast: brandPrimary,
50 border: `1px solid ${brandPrimary}`,
51 },
11 }; 52 };
12}
13
14export const brandPrimary = '#7266F0';
15export const brandSuccess = '#5cb85c';
16export const brandInfo = '#5bc0de';
17export const brandWarning = '#FF9F00';
18export const brandDanger = '#d9534f';
19
20export const uiFontSize = 14;
21
22export const borderRadius = legacyStyles.themeBorderRadius;
23export const borderRadiusSmall = legacyStyles.themeBorderRadiusSmall;
24
25export const colorBackground = legacyStyles.themeGrayLighter;
26export const colorContentBackground = '#FFFFFF';
27export const colorHeadline = legacyStyles.themeGrayDark;
28
29export const colorText = legacyStyles.themeTextColor;
30
31export const defaultContentBorder = color(legacyStyles.themeGrayLighter).darken(0.1).rgb().string();
32
33// Subscription Container Component
34export const colorSubscriptionContainerBackground = 'none';
35export const colorSubscriptionContainerBorder = `1px solid ${brandPrimary}`;
36export const colorSubscriptionContainerTitle = brandPrimary;
37export const colorSubscriptionContainerActionButtonBackground = brandPrimary;
38export const colorSubscriptionContainerActionButtonColor = '#FFF';
39
40// Loader
41export const colorAppLoaderSpinner = '#FFF';
42export const colorFullscreenLoaderSpinner = legacyStyles.themeGrayDark;
43export const colorWebviewLoaderBackground = color(legacyStyles.themeGrayLighter).alpha(0.8).rgb().string();
44
45// Input
46export const labelColor = legacyStyles.themeGrayLight;
47export const inputColor = legacyStyles.themeGray;
48export const inputHeight = 40;
49export const inputBackground = legacyStyles.themeGrayLightest;
50export const inputBorder = `1px solid ${legacyStyles.themeGrayLighter}`;
51export const inputModifierColor = legacyStyles.themeGrayLight;
52export const inputPlaceholderColor = color(legacyStyles.themeGrayLight).lighten(0.3).hex();
53export const inputPrefixColor = legacyStyles.themeGrayLight;
54export const inputPrefixBackground = legacyStyles.themeGrayLighter;
55export const inputDisabledOpacity = 0.5;
56export const inputScorePasswordBackground = legacyStyles.themeGrayLighter;
57
58// Toggle
59export const toggleBackground = legacyStyles.themeGrayLighter;
60export const toggleButton = legacyStyles.themeGrayLight;
61export const toggleButtonActive = brandPrimary;
62export const toggleWidth = 40;
63export const toggleHeight = 14;
64
65// Style Types
66export const styleTypes: IStyleTypes = {
67 primary: {
68 accent: brandPrimary,
69 contrast: '#FFF',
70 },
71 secondary: {
72 accent: legacyStyles.themeGrayLighter,
73 contrast: legacyStyles.themeGray,
74 },
75 success: {
76 accent: brandSuccess,
77 contrast: '#FFF',
78 },
79 warning: {
80 accent: brandWarning,
81 contrast: '#FFF',
82 },
83 danger: {
84 accent: brandDanger,
85 contrast: '#FFF',
86 },
87 inverted: {
88 accent: 'none',
89 contrast: brandPrimary,
90 border: `1px solid ${brandPrimary}`,
91 },
92};
93
94// Button
95export const buttonPrimaryBackground = brandPrimary;
96export const buttonPrimaryTextColor = '#FFF';
97
98export const buttonSecondaryBackground = legacyStyles.themeGrayLighter;
99export const buttonSecondaryTextColor = legacyStyles.themeGray;
100 53
101export const buttonSuccessBackground = brandSuccess; 54 const services = {
102export const buttonSuccessTextColor = '#FFF'; 55 listItems: {
103 56 padding: 10,
104export const buttonDangerBackground = brandDanger; 57 height: 57,
105export const buttonDangerTextColor = '#FFF'; 58 borderColor: legacyStyles.themeGrayLightest,
59 hoverBgColor: legacyStyles.themeGrayLightest,
60 disabled: {
61 color: legacyStyles.themeGrayLight,
62 },
63 },
64 };
106 65
107export const buttonWarningBackground = brandWarning; 66 return {
108export const buttonWarningTextColor = '#FFF'; 67 brandPrimary,
68 brandSuccess,
69 brandInfo,
70 brandWarning,
71 brandDanger,
109 72
110export const buttonInvertedBackground = 'none'; 73 uiFontSize,
111export const buttonInvertedTextColor = brandPrimary;
112export const buttonInvertedBorder = `1px solid ${brandPrimary}`;
113 74
114export const buttonHeight = inputHeight; 75 borderRadius: legacyStyles.themeBorderRadius,
76 borderRadiusSmall: legacyStyles.themeBorderRadiusSmall,
77
78 colorBackground,
79
80 colorContentBackground,
81 colorHeadline: legacyStyles.themeGrayDark,
82
83 colorText,
84
85 defaultContentBorder: color(legacyStyles.themeGrayLighter).darken(0.1).rgb().string(),
86
87 // Subscription Container Component
88 colorSubscriptionContainerBackground: 'none',
89 colorSubscriptionContainerBorder: `1px solid ${brandPrimary}`,
90 colorSubscriptionContainerTitle: brandPrimary,
91 colorSubscriptionContainerActionButtonBackground: brandPrimary,
92 colorSubscriptionContainerActionButtonColor: '#FFF',
93
94 // Loader
95 colorAppLoaderSpinner: '#FFF',
96 colorFullscreenLoaderSpinner: legacyStyles.themeGrayDark,
97 colorWebviewLoaderBackground: color(legacyStyles.themeGrayLighter).alpha(0.8).rgb().string(),
98
99 // Input
100 labelColor: legacyStyles.themeGrayLight,
101 inputColor,
102 inputHeight,
103 inputBackground,
104 inputBorder,
105 inputModifierColor: legacyStyles.themeGrayLight,
106 inputPlaceholderColor: color(legacyStyles.themeGrayLight).lighten(0.3).hex(),
107 inputPrefixColor,
108 inputPrefixBackground: legacyStyles.themeGrayLighter,
109 inputDisabledOpacity,
110 inputScorePasswordBackground: legacyStyles.themeGrayLighter,
111
112 // Toggle
113 toggleBackground: legacyStyles.themeGrayLighter,
114 toggleButton: legacyStyles.themeGrayLight,
115 toggleButtonActive: brandPrimary,
116 toggleWidth: 40,
117 toggleHeight: 14,
118
119 // Style Types
120 styleTypes,
121
122 // Button
123 buttonPrimaryBackground: brandPrimary,
124 buttonPrimaryTextColor: '#FFF',
125
126 buttonSecondaryBackground: legacyStyles.themeGrayLighter,
127 buttonSecondaryTextColor,
128
129 buttonSuccessBackground: brandSuccess,
130 buttonSuccessTextColor: '#FFF',
131
132 buttonDangerBackground: brandDanger,
133 buttonDangerTextColor: '#FFF',
134
135 buttonWarningBackground: brandWarning,
136 buttonWarningTextColor: '#FFF',
137
138 buttonInvertedBackground: 'none',
139 buttonInvertedTextColor: brandPrimary,
140 buttonInvertedBorder: `1px solid ${brandPrimary}`,
141
142 buttonHeight: inputHeight,
143
144 buttonLoaderColor: {
145 primary: '#FFF',
146 secondary: buttonSecondaryTextColor,
147 success: '#FFF',
148 warning: '#FFF',
149 danger: '#FFF',
150 inverted: brandPrimary,
151 },
115 152
116export const buttonLoaderColor = { 153 // Select
117 primary: '#FFF', 154 selectBackground: inputBackground,
118 secondary: buttonSecondaryTextColor, 155 selectBorder: inputBorder,
119 success: '#FFF', 156 selectHeight: inputHeight,
120 warning: '#FFF', 157 selectColor,
121 danger: '#FFF', 158 selectToggleColor: inputPrefixColor,
122 inverted: brandPrimary, 159 selectPopupBackground: '#FFF',
123}; 160 selectOptionColor: inputColor,
161 selectOptionBorder: `1px solid ${legacyStyles.themeGrayLightest}`,
162 selectOptionItemHover: legacyStyles.themeGrayLighter,
163 selectOptionItemHoverColor: selectColor,
164 selectOptionItemActive: brandPrimary,
165 selectOptionItemActiveColor: '#FFF',
166 selectSearchBackground: legacyStyles.themeGrayLighter,
167 selectSearchColor: inputColor,
168 selectDisabledOpacity: inputDisabledOpacity,
169
170 // Badge
171 badgeFontSize: uiFontSize - 2,
172 badgeBorderRadius: 50,
173
174 // Modal
175 colorModalOverlayBackground: color('#000').alpha(0.8).rgb().string(),
176 colorModalBackground: colorContentBackground,
177
178 // Services
179 services,
180
181 // Service Icon
182 serviceIcon: {
183 width: 35,
184 isCustom: {
185 border: `1px solid ${legacyStyles.themeGrayLighter}`,
186 borderRadius: legacyStyles.themeBorderRadius,
187 width: 37,
188 },
189 },
124 190
125// Select 191 // Workspaces
126export const selectBackground = inputBackground; 192 workspaces: {
127export const selectBorder = inputBorder; 193 settings: {
128export const selectHeight = inputHeight; 194 listItems: cloneDeep(services.listItems),
129export const selectColor = inputColor; 195 },
130export const selectToggleColor = inputPrefixColor; 196 drawer: {
131export const selectPopupBackground = '#FFF'; 197 width: 300,
132export const selectOptionColor = inputColor; 198 padding: 20,
133export const selectOptionBorder = `1px solid ${legacyStyles.themeGrayLightest}`; 199 background: drawerBg,
134export const selectOptionItemHover = legacyStyles.themeGrayLighter; 200 buttons: {
135export const selectOptionItemHoverColor = selectColor; 201 color: color(legacyStyles.themeGrayLight).lighten(0.1).hex(),
136export const selectOptionItemActive = brandPrimary; 202 hoverColor: legacyStyles.themeGrayLight,
137export const selectOptionItemActiveColor = '#FFF'; 203 },
138export const selectSearchBackground = legacyStyles.themeGrayLighter; 204 listItem: {
139export const selectSearchColor = inputColor; 205 hoverBackground: color(drawerBg).darken(0.01).hex(),
140export const selectDisabledOpacity = inputDisabledOpacity; 206 activeBackground: legacyStyles.themeGrayLightest,
141 207 border: color(drawerBg).darken(0.05).hex(),
142// Badge 208 name: {
143export const badgeFontSize = uiFontSize - 2; 209 color: colorText,
144export const badgeBorderRadius = 50; 210 activeColor: colorText,
145 211 },
146// Modal 212 services: {
147export const colorModalOverlayBackground = color('#000').alpha(0.8).rgb().string(); 213 color: color(colorText).lighten(1.5).hex(),
148export const colorModalBackground = colorContentBackground; 214 active: color(colorText).lighten(1.5).hex(),
149 215 },
150// Services 216 },
151export const services = { 217 },
152 listItems: { 218 switchingIndicator: {
153 padding: 10, 219 spinnerColor: 'white',
154 height: 57, 220 },
155 borderColor: legacyStyles.themeGrayLightest,
156 hoverBgColor: legacyStyles.themeGrayLightest,
157 disabled: {
158 color: legacyStyles.themeGrayLight,
159 }, 221 },
160 },
161};
162 222
163// Service Icon 223 // Announcements
164export const serviceIcon = { 224 announcements: {
165 width: 35, 225 spotlight: {
166 isCustom: { 226 background: legacyStyles.themeGrayLightest,
167 border: `1px solid ${legacyStyles.themeGrayLighter}`, 227 },
168 borderRadius: legacyStyles.themeBorderRadius, 228 },
169 width: 37,
170 },
171};
172 229
173// Workspaces 230 // Signup
174const drawerBg = color(colorBackground).lighten(0.1).hex(); 231 signup: {
175 232 pricing: {
176export const workspaces = { 233 feature: {
177 settings: { 234 background: legacyStyles.themeGrayLightest,
178 listItems: cloneDeep(services.listItems), 235 border: legacyStyles.themeGrayLighter,
179 }, 236 },
180 drawer: { 237 },
181 width: 300,
182 padding: 20,
183 background: drawerBg,
184 buttons: {
185 color: color(legacyStyles.themeGrayLight).lighten(0.1).hex(),
186 hoverColor: legacyStyles.themeGrayLight,
187 }, 238 },
188 listItem: { 239
189 hoverBackground: color(drawerBg).darken(0.01).hex(), 240 // Todos
190 activeBackground: legacyStyles.themeGrayLightest, 241 todos: {
191 border: color(drawerBg).darken(0.05).hex(), 242 todosLayer: {
192 name: { 243 borderLeftColor: color(legacyStyles.themeGrayLighter).darken(0.1).hex(),
193 color: colorText, 244 },
194 activeColor: colorText, 245 toggleButton: {
246 background: styleTypes.primary.accent,
247 textColor: styleTypes.primary.contrast,
248 shadowColor: 'rgba(0, 0, 0, 0.2)',
195 }, 249 },
196 services: { 250 dragIndicator: {
197 color: color(colorText).lighten(1.5).hex(), 251 background: legacyStyles.themeGrayLight,
198 active: color(colorText).lighten(1.5).hex(), 252 },
253 resizeHandler: {
254 backgroundHover: styleTypes.primary.accent,
199 }, 255 },
200 }, 256 },
201 },
202 switchingIndicator: {
203 spinnerColor: 'white',
204 },
205};
206 257
207// Announcements 258 // TrialStatusBar
208export const announcements = { 259 trialStatusBar: {
209 spotlight: { 260 bar: {
210 background: legacyStyles.themeGrayLightest, 261 background: legacyStyles.themeGrayLightest,
211 }, 262 },
212}; 263 progressBar: {
213 264 background: color(legacyStyles.themeGrayLighter).darken(0.1).hex(),
214// Signup 265 progressIndicator: legacyStyles.themeGrayLight,
215export const signup = { 266 },
216 pricing: {
217 feature: {
218 background: legacyStyles.themeGrayLightest,
219 border: legacyStyles.themeGrayLighter,
220 }, 267 },
221 },
222};
223 268
224// Todos 269 legacyStyles,
225export const todos = { 270 };
226 todosLayer: {
227 borderLeftColor: color(legacyStyles.themeGrayLighter).darken(0.1).hex(),
228 },
229 toggleButton: {
230 background: styleTypes.primary.accent,
231 textColor: styleTypes.primary.contrast,
232 shadowColor: 'rgba(0, 0, 0, 0.2)',
233 },
234 dragIndicator: {
235 background: legacyStyles.themeGrayLight,
236 },
237 resizeHandler: {
238 backgroundHover: styleTypes.primary.accent,
239 },
240};
241
242// TrialStatusBar
243export const trialStatusBar = {
244 bar: {
245 background: legacyStyles.themeGrayLightest,
246 },
247 progressBar: {
248 background: color(legacyStyles.themeGrayLighter).darken(0.1).hex(),
249 progressIndicator: legacyStyles.themeGrayLight,
250 },
251}; 271};