Skip to content

Commit 13dd07b

Browse files
committed
[theme] normalizeColor drops colors with alpha
1 parent 86ed221 commit 13dd07b

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

src/vs/workbench/services/themes/common/colorThemeData.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -788,29 +788,27 @@ function normalizeColor(color: string | Color | undefined | null): string | unde
788788
if (typeof color !== 'string') {
789789
color = Color.Format.CSS.formatHexA(color, true);
790790
}
791-
if (color.charCodeAt(0) !== CharCode.Hash) {
791+
const len = color.length;
792+
if (color.charCodeAt(0) !== CharCode.Hash || (len !== 4 && len !== 5 && len !== 7 && len !== 9)) {
792793
return undefined;
793794
}
794795
let result = [CharCode.Hash];
795-
const len = color.length;
796+
796797
for (let i = 1; i < len; i++) {
797798
const upper = hexUpper(color.charCodeAt(i));
798799
if (!upper) {
799800
return undefined;
800801
}
801802
result.push(upper);
802-
if (len === 3 || len === 4) {
803+
if (len === 4 || len === 5) {
803804
result.push(upper);
804805
}
805806
}
806807

807808
if (result.length === 9 && result[7] === CharCode.F && result[8] === CharCode.F) {
808809
result.length = 7;
809810
}
810-
if (result.length === 7) {
811-
return String.fromCharCode(...result);
812-
}
813-
return undefined;
811+
return String.fromCharCode(...result);
814812
}
815813

816814
function hexUpper(charCode: CharCode): number {

0 commit comments

Comments
 (0)