Merge pull request #1084 from Tyriar/1079_theme_exception

Fix exception when setting theme
This commit is contained in:
Daniel Imms
2017-10-27 10:14:43 -07:00
committed by GitHub
2 changed files with 9 additions and 0 deletions
+6
View File
@@ -269,6 +269,12 @@ describe('ColorManager', () => {
});
describe('setTheme', () => {
it('should not throw when not setting all colors', () => {
assert.doesNotThrow(() => {
cm.setTheme({});
});
});
it('should set a partial set of colors, using the default if not present', () => {
assert.equal(cm.colors.background, '#000000');
assert.equal(cm.colors.foreground, '#ffffff');
+3
View File
@@ -109,6 +109,9 @@ export class ColorManager implements IColorManager {
}
private _validateColor(color: string, fallback: string): string {
if (!color) {
return fallback;
}
if (color.length === 7 && color.charAt(0) === '#') {
return color;
}