Make type optional

This commit is contained in:
Daniel Imms
2018-05-28 06:36:17 -07:00
parent 2eb510f6cc
commit 8bbcf0c3c4
2 changed files with 2 additions and 1 deletions

View File

@@ -14,7 +14,7 @@ export interface IBaseColorSet {
} }
export interface IColorSet { export interface IColorSet {
type: 'light' | 'dark'; type?: 'light' | 'dark';
base: IBaseColorSet; base: IBaseColorSet;
syntax?: { syntax?: {
boolean?: string; boolean?: string;

View File

@@ -12,6 +12,7 @@ export interface IVscodeJsonTheme {
export class VscodeThemeGenerator implements IThemeGenerator { export class VscodeThemeGenerator implements IThemeGenerator {
public generateTheme(name: string, colorSet: IColorSet): string { public generateTheme(name: string, colorSet: IColorSet): string {
// Fill in missing subsets to prevent NPEs // Fill in missing subsets to prevent NPEs
if (!colorSet.type) colorSet.type = 'dark';
if (!colorSet.syntax) colorSet.syntax = {}; if (!colorSet.syntax) colorSet.syntax = {};
if (!colorSet.terminal) colorSet.terminal = {}; if (!colorSet.terminal) colorSet.terminal = {};
if (!colorSet.ui) colorSet.ui = {}; if (!colorSet.ui) colorSet.ui = {};