Skip to content

Commit 783df3e

Browse files
committed
fix: set color.toString hex
1 parent 7a02a3a commit 783df3e

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

packages/tailwindcss-language-service/src/completionProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ function stringifyDecls(
11111111
let hex = ''
11121112
const color = showColorEquivalents ? getColorsInString(value)[0] : undefined
11131113
if(color instanceof TinyColor) {
1114-
hex = color.toString() || ''
1114+
hex = color.toString('hex') || ''
11151115
}
11161116
return `${prop}: ${value}${px ? `/* ${px} */` : ''}${hex ? `/* ${hex} */` : ''};`
11171117
})

packages/tailwindcss-language-service/src/util/jit.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export async function stringifyRoot(state: State, root: Root, uri?: string): Pro
5555
clone.walkDecls((decl) => {
5656
const color = getColorsInString(decl.value)[0]
5757
if(color && color instanceof TinyColor) {
58-
decl.value = `${decl.value}/* ${color.toString()} */`
58+
decl.value = `${decl.value}/* ${color.toString('hex')} */`
5959
}
6060
})
6161
}
@@ -85,7 +85,7 @@ export async function stringifyDecls(state: State, rule: Rule, uri?: string): Pr
8585
let hex = ''
8686
const color = showColorEquivalents ? getColorsInString(value)[0] : undefined
8787
if(color instanceof TinyColor) {
88-
hex = color.toString() || ''
88+
hex = color.toString('hex') || ''
8989
}
9090
result.push(`${prop}: ${value}${px ? `/* ${px} */` : ''}${hex ? `/* ${hex} */` : ''};`)
9191
})

packages/tailwindcss-language-service/src/util/stringify.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export function stringifyCss(
7474
let hex = ''
7575
if(color) {
7676
hex = color.map(c => {
77-
return c instanceof TinyColor ? c.toString() : c
77+
return c instanceof TinyColor ? c.toString('hex') : c
7878
}).join(' ')
7979
}
8080
return `${indentStr + indent}${curr}: ${val}${px ? `/* ${px} */` : ''}${hex ? `/* ${hex} */` : ''};`

0 commit comments

Comments
 (0)