Skip to content

Commit eae6de3

Browse files
committed
Ignore 'null' as color values
1 parent 77d373e commit eae6de3

2 files changed

Lines changed: 7 additions & 9 deletions

File tree

src/vs/workbench/services/themes/electron-browser/colorThemeData.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,7 @@ export class ColorThemeData implements IColorTheme {
8181
for (let id in colors) {
8282
let colorVal = colors[id];
8383
if (typeof colorVal === 'string') {
84-
let color = Color.fromHex(colorVal);
85-
if (color) {
86-
this.customColorMap[id] = color;
87-
}
84+
this.customColorMap[id] = Color.fromHex(colorVal);
8885
}
8986
}
9087
if (this.themeTokenColors && this.themeTokenColors.length) {
@@ -257,9 +254,9 @@ function _loadColorThemeFromFile(themePath: string, resultRules: ITokenColorizat
257254
}
258255
// new JSON color themes format
259256
for (let colorId in colors) {
260-
let colorHex = Color.fromHex(colors[colorId]);
261-
if (colorHex) { // ignore invalid colors
262-
resultColors[colorId] = colorHex;
257+
let colorHex = colors[colorId];
258+
if (typeof colorHex === 'string') { // ignore colors tht are null
259+
resultColors[colorId] = Color.fromHex(colors[colorId]);
263260
}
264261
}
265262
}

src/vs/workbench/services/themes/electron-browser/themeCompatibility.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ export function convertSettings(oldSettings: ITokenColorizationRule[], resultRul
3131
for (let key in settings) {
3232
let mappings = settingToColorIdMapping[key];
3333
if (mappings) {
34-
let color = Color.fromHex(settings[key]);
35-
if (color) {
34+
let colorHex = settings[key];
35+
if (typeof colorHex === 'string') {
36+
let color = Color.fromHex(colorHex);
3637
for (let colorId of mappings) {
3738
resultColors[colorId] = color;
3839
}

0 commit comments

Comments
 (0)