Skip to content

Commit fff263e

Browse files
authored
Merge pull request #4 from dbhurley/fix/token-color-error
fix: handle shorthand hex colors in SkillDiffCard
2 parents af40c53 + 219e325 commit fff263e

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
@@ -464,8 +464,11 @@ function applyMonacoTheme(monaco: NonNullable<ReturnType<typeof useMonaco>>) {
464464
}
465465

466466
function normalizeHex(value: string) {
467-
if (value.startsWith('#')) return value
468-
return '#000000'
467+
if (!value.startsWith('#')) return '#000000'
468+
if (value.length === 4) {
469+
return `#${value[1]}${value[1]}${value[2]}${value[2]}${value[3]}${value[3]}`
470+
}
471+
return value
469472
}
470473

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

0 commit comments

Comments
 (0)