Skip to content

Commit 219e325

Browse files
committed
fix: normalize hex colors in SkillDiffCard to prevent Monaco crash
1 parent 5e15989 commit 219e325

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/components/SkillDiffCard.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,11 @@ function applyMonacoTheme(monaco: NonNullable<ReturnType<typeof useMonaco>>) {
461461
}
462462

463463
function normalizeHex(value: string) {
464-
if (value.startsWith('#')) return value
465-
return '#000000'
464+
if (!value.startsWith('#')) return '#000000'
465+
if (value.length === 4) {
466+
return `#${value[1]}${value[1]}${value[2]}${value[2]}${value[3]}${value[3]}`
467+
}
468+
return value
466469
}
467470

468471
function toRgba(color: string, alpha: number) {

0 commit comments

Comments
 (0)