提交 eae6de34 编写于 作者: M Martin Aeschlimann

Ignore 'null' as color values

上级 77d373e3
......@@ -81,10 +81,7 @@ export class ColorThemeData implements IColorTheme {
for (let id in colors) {
let colorVal = colors[id];
if (typeof colorVal === 'string') {
let color = Color.fromHex(colorVal);
if (color) {
this.customColorMap[id] = color;
}
this.customColorMap[id] = Color.fromHex(colorVal);
}
}
if (this.themeTokenColors && this.themeTokenColors.length) {
......@@ -257,9 +254,9 @@ function _loadColorThemeFromFile(themePath: string, resultRules: ITokenColorizat
}
// new JSON color themes format
for (let colorId in colors) {
let colorHex = Color.fromHex(colors[colorId]);
if (colorHex) { // ignore invalid colors
resultColors[colorId] = colorHex;
let colorHex = colors[colorId];
if (typeof colorHex === 'string') { // ignore colors tht are null
resultColors[colorId] = Color.fromHex(colors[colorId]);
}
}
}
......
......@@ -31,8 +31,9 @@ export function convertSettings(oldSettings: ITokenColorizationRule[], resultRul
for (let key in settings) {
let mappings = settingToColorIdMapping[key];
if (mappings) {
let color = Color.fromHex(settings[key]);
if (color) {
let colorHex = settings[key];
if (typeof colorHex === 'string') {
let color = Color.fromHex(colorHex);
for (let colorId of mappings) {
resultColors[colorId] = color;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册