8000 fix(preset-wind4): fix theme color resolved key (#4461) · unocss/unocss@c78d0ae · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit c78d0ae

Browse files
authored
fix(preset-wind4): fix theme color resolved key (#4461)
1 parent ad5b40b commit c78d0ae

File tree

5 files changed

+97
-94
lines changed

5 files changed

+97
-94
lines changed

packages-presets/preset-wind4/src/rules/background.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function bgGradientColorResolver() {
3939
}
4040
else {
4141
css[`--un-${position}-opacity`] = `${opacity || 100}%`
42-
const value = key ? `var(--color-${key})` : color
42+
const value = key ? `var(--colors-${key})` : color
4343
css[`--un-gradient-${position}`] = `color-mix(in oklab, ${value} var(--un-${position}-opacity), transparent)`
4444
}
4545
}

packages-presets/preset-wind4/src/rules/border.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function transformBorderColor(color: string, opacity: string | number | undefine
6060
if (direction && direction !== '') {
6161
css[`--un-border${direction}-opacity`] = `var(--un-border-opacity)`
6262
}
63-
const value = key ? `var(--color-${key})` : color
63+
const value = key ? `var(--colors-${key})` : color
6464
css[`border${direction}-color`] = `color-mix(in oklch, ${value} var(--un-border${direction}-opacity), transparent)`
6565
}
6666
}

packages-presets/preset-wind4/src/theme/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export interface Theme {
1818
breakpoint?: Record<string, string>
1919
verticalBreakpoint?: Record<string, string>
2020
container?: Record<string, string>
21-
text: Record<string, { fontSize?: string, lineHeight?: string, letterSpacing?: string }>
21+
text?: Record<string, { fontSize?: string, lineHeight?: string, letterSpacing?: string }>
2222
fontWeight?: Record<string, string>
2323
tracking?: Record<string, string>
2424
leading?: Record<string, string>

packages-presets/preset-wind4/src/utils/utilities.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export function colorResolver(property: string, varName: string) {
141141
}
142142
else {
143143
css[`--un-${varName}-opacity`] = `${opacity || 100}%`
144-
const value = key ? `var(--color-${key})` : color
144+
const value = key ? `var(--colors-${key})` : color
145145
css[property] = `color-mix(in oklch, ${value} var(--un-${varName}-opacity), transparent)${rawColorComment}`
146146
}
147147
}
@@ -207,6 +207,9 @@ export function parseColor(body: string, theme: Theme) {
207207
* Key means the color is from theme object.
208208
*/
209209
key,
210+
get cssColor() {
211+
return parseCssColor(this.color)
212+
},
210213
}
211214
}
212215

0 commit comments

Comments
 (0)
0