Skip to content

Commit 4f09135

Browse files
author
mdatelle
committed
refatcor: rename gradient vars
1 parent 3e8d085 commit 4f09135

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

web/store/theme.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ export const defaultColors: Record<string, ThemeVariables> = {
4646
'--header-text-primary': '#1c1c1c',
4747
'--header-text-secondary': '#999999',
4848
'--header-background-color': '#f2f2f2',
49-
'--color-customgradient-start': 'rgba(0, 0, 0, 0)',
50-
'--color-customgradient-end': 'var(--header-background-color)',
49+
'--gradient-start': 'rgba(0, 0, 0, 0)',
50+
'--gradient-end': 'var(--header-background-color)',
5151
},
5252
light: {
5353
'--background': '0 0% 100%',
@@ -73,8 +73,8 @@ export const defaultColors: Record<string, ThemeVariables> = {
7373
'--header-text-primary': '#f2f2f2',
7474
'--header-text-secondary': '#999999',
7575
'--header-background-color': '#1c1b1b',
76-
'--color-customgradient-start': 'rgba(0, 0, 0, 0)',
77-
'--color-customgradient-end': 'var(--header-background-color)',
76+
'--gradient-start': 'rgba(0, 0, 0, 0)',
77+
'--gradient-end': 'var(--header-background-color)',
7878
},
7979
} as const;
8080

@@ -133,10 +133,8 @@ export const useThemeStore = defineStore('theme', () => {
133133
if (!theme.value?.banner || !theme.value?.bannerGradient) {
134134
return undefined;
135135
}
136-
const start = theme.value?.bgColor ? 'var(--color-customgradient-start)' : 'rgba(0, 0, 0, 0)';
137-
const end = theme.value?.bgColor
138-
? 'var(--color-customgradient-end)'
139-
: 'var(--header-background-color)';
136+
const start = theme.value?.bgColor ? 'var(--gradient-start)' : 'rgba(0, 0, 0, 0)';
137+
const end = theme.value?.bgColor ? 'var(--gradient-end)' : 'var(--header-background-color)';
140138
return `background-image: linear-gradient(90deg, ${start} 0, ${end} 30%);`;
141139
});
142140
// Actions
@@ -162,10 +160,10 @@ export const useThemeStore = defineStore('theme', () => {
162160
if (theme.value?.banner && theme.value?.bannerGradient) {
163161
const start = theme.value?.bgColor
164162
? hexToRgba(theme.value.bgColor, 0)
165-
: customColorVariables[selectedMode]['--color-customgradient-start'];
163+
: customColorVariables[selectedMode]['--gradient-start'];
166164
const end = theme.value?.bgColor
167165
? hexToRgba(theme.value.bgColor, 0.7)
168-
: customColorVariables[selectedMode]['--color-customgradient-end'];
166+
: customColorVariables[selectedMode]['--gradient-end'];
169167
body.style.setProperty('--banner-gradient', `linear-gradient(90deg, ${start} 0, ${end} 30%)`);
170168
} else {
171169
body.style.removeProperty('--banner-gradient');
@@ -190,8 +188,8 @@ export const useThemeStore = defineStore('theme', () => {
190188
}
191189
if (theme.value?.bgColor) {
192190
body.style.setProperty('--header-background-color', theme.value.bgColor);
193-
body.style.setProperty('--color-customgradient-start', hexToRgba(theme.value.bgColor, 0));
194-
body.style.setProperty('--color-customgradient-end', hexToRgba(theme.value.bgColor, 0.7));
191+
body.style.setProperty('--gradient-start', hexToRgba(theme.value.bgColor, 0));
192+
body.style.setProperty('--gradient-end', hexToRgba(theme.value.bgColor, 0.7));
195193
} else {
196194
body.style.setProperty(
197195
'--header-background-color',

0 commit comments

Comments
 (0)