Skip to content

Commit c53560e

Browse files
committed
refactor(themes): clean up colors
1 parent d1c5da7 commit c53560e

File tree

10 files changed

+38
-44
lines changed

10 files changed

+38
-44
lines changed

core/src/themes/base/dark.tokens.primitives.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

core/src/themes/base/dark.tokens.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { mix } from '../../utils/theme';
1+
import { mix, generateColorSteps } from '../../utils/theme';
22
import type { DarkTheme } from '../themes.interfaces';
33

4-
import { darkPrimitiveColors } from './dark.tokens.primitives';
4+
import { colors as defaultColors } from './default.tokens';
55

6-
const colors = {
6+
export const colors = {
77
primary: '#4d8dff',
88
secondary: '#46b1ff',
99
tertiary: '#8482fb',
@@ -13,7 +13,7 @@ const colors = {
1313
light: '#222428',
1414
medium: '#989aa2',
1515
dark: '#f4f5f8',
16-
...darkPrimitiveColors,
16+
gray: generateColorSteps(defaultColors.white, defaultColors.black, true),
1717
};
1818

1919
export const darkTheme: DarkTheme = {

core/src/themes/base/default.tokens.primitives.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

core/src/themes/base/default.tokens.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1+
import { generateColorSteps } from '../../utils/theme';
12
import type { DefaultTheme } from '../themes.interfaces';
23

34
import { darkTheme } from './dark.tokens';
4-
import { defaultPrimitiveColors } from './default.tokens.primitives';
55
import { highContrastDarkTheme } from './high-contrast-dark.tokens';
66
import { highContrastTheme } from './high-contrast.tokens';
77
import { lightTheme } from './light.tokens';
88

9+
export const colors = {
10+
white: '#ffffff',
11+
black: '#000000',
12+
gray: generateColorSteps('#fff', '#000'),
13+
};
14+
915
export const defaultTheme: DefaultTheme = {
1016
name: 'base',
1117

@@ -166,11 +172,11 @@ export const defaultTheme: DefaultTheme = {
166172
xxl: '2.4',
167173
},
168174

169-
// TODO: Note to self: these colors are applied to all themes unless overridden in a specific theme
170175
color: {
171-
...defaultPrimitiveColors,
172-
text: defaultPrimitiveColors.gray,
176+
...colors,
177+
text: colors.gray,
173178
},
179+
174180
components: {
175181
IonBreadcrumb: {
176182
separatorColor: 'var(--ion-color-text-550)',

core/src/themes/base/high-contrast-dark.tokens.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { generateColorSteps, mix } from '../../utils/theme';
22
import type { HighContrastDarkTheme } from '../themes.interfaces';
33

4-
import { darkPrimitiveColors as baseDarkPrimitiveColors } from './dark.tokens.primitives';
4+
import { colors as defaultDarkColors } from './dark.tokens';
5+
import { colors as defaultColors } from './default.tokens';
56

67
const colors = {
78
primary: '#7cabff',
@@ -13,7 +14,7 @@ const colors = {
1314
light: '#222428',
1415
medium: '#a8aab3',
1516
dark: '#f4f5f8',
16-
...baseDarkPrimitiveColors,
17+
gray: defaultDarkColors.gray,
1718
};
1819

1920
export const highContrastDarkTheme: HighContrastDarkTheme = {
@@ -167,8 +168,8 @@ export const highContrastDarkTheme: HighContrastDarkTheme = {
167168
text: generateColorSteps('#ffffff', '#888888', true),
168169
},
169170

170-
backgroundColor: '#000000',
171+
backgroundColor: defaultColors.black,
171172
backgroundColorRgb: '0, 0, 0',
172-
textColor: '#ffffff',
173+
textColor: defaultColors.white,
173174
textColorRgb: '255, 255, 255',
174175
};

core/src/themes/base/high-contrast.tokens.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { generateColorSteps, mix } from '../../utils/theme';
22
import type { HighContrastTheme } from '../themes.interfaces';
33

4+
import { colors as defaultColors } from './default.tokens';
5+
46
const colors = {
57
primary: '#003fae',
68
secondary: '#01487b',
@@ -160,11 +162,11 @@ export const highContrastTheme: HighContrastTheme = {
160162
tint: mix('#fff', colors.dark, '4%'),
161163
},
162164
},
163-
text: generateColorSteps('#888888', '#000000'),
165+
text: generateColorSteps('#888888', defaultColors.black),
164166
},
165167

166-
backgroundColor: '#ffffff',
168+
backgroundColor: defaultColors.white,
167169
backgroundColorRgb: '255, 255, 255',
168-
textColor: '#000000',
170+
textColor: defaultColors.black,
169171
textColorRgb: '0, 0, 0',
170172
};

core/src/themes/ios/dark.tokens.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { darkTheme as baseDarkTheme } from '../base/dark.tokens';
2-
import { darkPrimitiveColors as baseDarkPrimitiveColors } from '../base/dark.tokens.primitives';
1+
import { darkTheme as baseDarkTheme, colors as defaultDarkColors } from '../base/dark.tokens';
2+
import { colors as defaultColors } from '../base/default.tokens';
33
import type { DarkTheme } from '../themes.interfaces';
44

55
const colors = {
6-
background: '#000000',
7-
textColor: '#ffffff',
8-
gray: baseDarkPrimitiveColors.gray,
6+
background: defaultColors.black,
7+
textColor: defaultColors.white,
8+
gray: defaultDarkColors.gray,
99
};
1010

1111
export const darkTheme: DarkTheme = {

core/src/themes/ios/light.tokens.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { defaultPrimitiveColors } from '../base/default.tokens.primitives';
1+
import { colors as defaultColors } from '../base/default.tokens';
22
import type { LightTheme } from '../themes.interfaces';
33

44
const colors = {
5-
gray: defaultPrimitiveColors.gray,
5+
gray: defaultColors.gray,
66
};
77

88
export const lightTheme: LightTheme = {
@@ -12,7 +12,7 @@ export const lightTheme: LightTheme = {
1212
},
1313
components: {
1414
IonActionSheet: {
15-
buttonBgSelected: `var(--ion-background-color, ${defaultPrimitiveColors.white})`,
15+
buttonBgSelected: `var(--ion-background-color, ${defaultColors.white})`,
1616
},
1717
IonDatetime: {
1818
timeBodyBg: '#edeef0',
@@ -44,7 +44,7 @@ export const lightTheme: LightTheme = {
4444
nativeSpinnerColor: '#747577', // Available only in iOS
4545
},
4646
IonSegmentButton: {
47-
checkedIndicatorBg: defaultPrimitiveColors.white, // Available only in iOS
47+
checkedIndicatorBg: defaultColors.white, // Available only in iOS
4848
},
4949
IonTabbar: {
5050
bg: 'var(--ion-tab-bar-background-color, #f7f7f7)',

core/src/themes/md/dark.tokens.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { generateColorSteps } from '../../utils/theme';
22
import { darkTheme as baseDarkTheme } from '../base/dark.tokens';
3+
import { colors as defaultColors } from '../base/default.tokens';
34
import type { DarkTheme } from '../themes.interfaces';
45

56
const colors = {
6-
gray: generateColorSteps('#ffffff', '#121212', true),
7+
gray: generateColorSteps(defaultColors.white, '#121212', true),
78
};
89

910
export const darkTheme: DarkTheme = {

core/src/themes/md/light.tokens.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { defaultPrimitiveColors } from '../base/default.tokens.primitives';
1+
import { colors as defaultColors } from '../base/default.tokens';
22
import type { LightTheme } from '../themes.interfaces';
33

44
export const lightTheme: LightTheme = {
55
components: {
66
IonBreadcrumb: {
77
color: '#677483',
8-
bgFocused: defaultPrimitiveColors.white,
8+
bgFocused: defaultColors.white,
99
iconColor: '#7d8894',
1010
iconColorActive: '#222d3a',
1111
indicatorBg: '#eef1f3',
@@ -14,7 +14,7 @@ export const lightTheme: LightTheme = {
1414
separatorColor: '#73849a',
1515
},
1616
IonDatetime: {
17-
bg: defaultPrimitiveColors.white,
17+
bg: defaultColors.white,
1818
timeBodyBg: '#edeef0',
1919
},
2020
IonItem: {

0 commit comments

Comments
 (0)