mirror of
https://github.com/Tyriar/vscode-theme-generator.git
synced 2025-12-07 09:36:11 -08:00
Improve types
This commit is contained in:
@@ -4,10 +4,27 @@ export interface IVscodeJsonTheme {
|
|||||||
name?: string;
|
name?: string;
|
||||||
include?: string;
|
include?: string;
|
||||||
globalSettings?: {
|
globalSettings?: {
|
||||||
background?: string;
|
background?: string
|
||||||
foreground?: string;
|
foreground?: string
|
||||||
|
};
|
||||||
|
settings?: IVscodeJsonThemeSetting[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IVscodeJsonGlobalSetting {
|
||||||
|
name: string;
|
||||||
|
settings: {
|
||||||
|
background?: string
|
||||||
|
foreground?: string
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IVscodeJsonThemeSetting {
|
||||||
|
name: string;
|
||||||
|
scope: string;
|
||||||
|
settings: {
|
||||||
|
foreground?: string
|
||||||
|
fontStyle?: string
|
||||||
};
|
};
|
||||||
settings?: any[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type SourceFetcher = (colorSet: IColorSet) => string;
|
type SourceFetcher = (colorSet: IColorSet) => string;
|
||||||
@@ -27,18 +44,18 @@ enum FontStyle {
|
|||||||
|
|
||||||
function getGlobalSettingGenerator(name: string): ColorGenerator {
|
function getGlobalSettingGenerator(name: string): ColorGenerator {
|
||||||
return (color: string) => {
|
return (color: string) => {
|
||||||
let globalSetting: any = {
|
let globalSetting: IVscodeJsonGlobalSetting = {
|
||||||
'name': name,
|
'name': name,
|
||||||
'settings': {}
|
'settings': {}
|
||||||
};
|
};
|
||||||
globalSetting.settings[name] = color;
|
(<any>globalSetting.settings)[name] = color;
|
||||||
return globalSetting;
|
return globalSetting;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSimpleColorGenerator(name: string, scope: string, fontStyle: number = FontStyle.NONE): ColorGenerator {
|
function getSimpleColorGenerator(name: string, scope: string, fontStyle: number = FontStyle.NONE): ColorGenerator {
|
||||||
return (color: string) => {
|
return (color: string) => {
|
||||||
let colorRule: any = {
|
let colorRule: IVscodeJsonThemeSetting = {
|
||||||
'name': name,
|
'name': name,
|
||||||
'scope': scope,
|
'scope': scope,
|
||||||
'settings': {
|
'settings': {
|
||||||
|
|||||||
Reference in New Issue
Block a user