mirror of
https://github.com/Tyriar/vscode-theme-generator.git
synced 2025-12-06 17:15:43 -08:00
18
.vscode/launch.json
vendored
18
.vscode/launch.json
vendored
@@ -1,14 +1,22 @@
|
|||||||
// A launch configuration that launches the extension inside a new window
|
// A launch configuration that compiles the extension and then opens it inside a new window
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
{
|
{
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "Launch Extension",
|
"name": "Extension",
|
||||||
"type": "extensionHost",
|
"type": "extensionHost",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"runtimeExecutable": "${execPath}",
|
"runtimeExecutable": "${execPath}",
|
||||||
"args": ["--extensionDevelopmentPath=${workspaceRoot}/demo" ],
|
"args": [
|
||||||
"preLaunchTask": "build"
|
"--extensionDevelopmentPath=${workspaceFolder}/demo"
|
||||||
|
],
|
||||||
|
"outFiles": [
|
||||||
|
"${workspaceFolder}/out/**/*.js"
|
||||||
|
],
|
||||||
|
"preLaunchTask": "npm: start"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
14
.vscode/tasks.json
vendored
14
.vscode/tasks.json
vendored
@@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "0.1.0",
|
|
||||||
"command": "npm",
|
|
||||||
"isShellCommand": true,
|
|
||||||
"showOutput": "always",
|
|
||||||
"suppressTaskName": true,
|
|
||||||
"tasks": [
|
|
||||||
{
|
|
||||||
"isBuildCommand": true,
|
|
||||||
"taskName": "build",
|
|
||||||
"args": ["start"]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -12,16 +12,17 @@ const sapphireColors = {
|
|||||||
pink: '#B168DF',
|
pink: '#B168DF',
|
||||||
teal: '#21C5C7',
|
teal: '#21C5C7',
|
||||||
grey: '#4A5160'
|
grey: '#4A5160'
|
||||||
}
|
};
|
||||||
|
|
||||||
const sapphireColorSet: IColorSet = {
|
const sapphireColorSet: IColorSet = {
|
||||||
|
type: 'dark',
|
||||||
base: {
|
base: {
|
||||||
background: '#12171f',
|
background: '#12171f',
|
||||||
foreground: '#efefef',
|
foreground: '#efefef',
|
||||||
color1: sapphireColors.blue,
|
color1: sapphireColors.blue,
|
||||||
color2: sapphireColors.red,
|
color2: sapphireColors.red,
|
||||||
color3: sapphireColors.green,
|
color3: sapphireColors.green,
|
||||||
color4: sapphireColors.yellow,
|
color4: sapphireColors.yellow
|
||||||
},
|
},
|
||||||
syntax: {
|
syntax: {
|
||||||
identifier: sapphireColors.blueLight,
|
identifier: sapphireColors.blueLight,
|
||||||
@@ -56,7 +57,7 @@ const sapphireColorSet: IColorSet = {
|
|||||||
// White with ~10% opacity
|
// White with ~10% opacity
|
||||||
wordHighlight: '#ffffff18',
|
wordHighlight: '#ffffff18',
|
||||||
wordHighlightStrong: '#ffffff18',
|
wordHighlightStrong: '#ffffff18',
|
||||||
activeLinkForeground: sapphireColors.blue,
|
activeLinkForeground: sapphireColors.blue
|
||||||
},
|
},
|
||||||
terminal: {
|
terminal: {
|
||||||
black: '#666666',
|
black: '#666666',
|
||||||
@@ -77,32 +78,47 @@ const sapphireColorSet: IColorSet = {
|
|||||||
brightWhite: '#efefef'
|
brightWhite: '#efefef'
|
||||||
},
|
},
|
||||||
overrides: {
|
overrides: {
|
||||||
"editorError.foreground": "#ff0000"
|
'editorError.foreground': '#ff0000'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const minimalColorSet: IColorSet = {
|
const minimalDarkColorSet: IColorSet = {
|
||||||
|
type: 'dark',
|
||||||
base: {
|
base: {
|
||||||
background: '#22272f',
|
background: '#22272f',
|
||||||
foreground: '#efefef',
|
foreground: '#efefef',
|
||||||
color1: sapphireColors.blue,
|
color1: sapphireColors.blue,
|
||||||
color2: sapphireColors.red,
|
color2: sapphireColors.red,
|
||||||
color3: sapphireColors.green,
|
color3: sapphireColors.green,
|
||||||
color4: sapphireColors.yellow,
|
color4: sapphireColors.yellow
|
||||||
},
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const minimalLightColorSet: IColorSet = {
|
||||||
|
type: 'light',
|
||||||
|
base: {
|
||||||
|
background: '#efefff',
|
||||||
|
foreground: '#000011',
|
||||||
|
color1: sapphireColors.blue,
|
||||||
|
color2: sapphireColors.red,
|
||||||
|
color3: sapphireColors.green,
|
||||||
|
color4: sapphireColors.yellow
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const minimalCoverageColorSet: IColorSet = {
|
const minimalCoverageColorSet: IColorSet = {
|
||||||
|
type: 'dark',
|
||||||
base: {
|
base: {
|
||||||
background: '#FF0000',
|
background: '#FF0000',
|
||||||
foreground: '#0000FF',
|
foreground: '#0000FF',
|
||||||
color1: '#00FF00',
|
color1: '#00FF00',
|
||||||
color2: '#00FF00',
|
color2: '#00FF00',
|
||||||
color3: '#00FF00',
|
color3: '#00FF00',
|
||||||
color4: '#00FF00',
|
color4: '#00FF00'
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
generateTheme('Generated Theme', sapphireColorSet, path.join(__dirname, 'theme.json'));
|
generateTheme('Generated Theme', sapphireColorSet, path.join(__dirname, 'theme.json'));
|
||||||
generateTheme('Generated Theme (minimal)', minimalColorSet, path.join(__dirname, 'theme-minimal.json'));
|
generateTheme('Generated Theme (minimal, dark)', minimalDarkColorSet, path.join(__dirname, 'theme-minimal-dark.json'));
|
||||||
|
generateTheme('Generated Theme (minimal, light)', minimalLightColorSet, path.join(__dirname, 'theme-minimal-light.json'));
|
||||||
generateTheme('Generated Theme (minimal, coverage)', minimalCoverageColorSet, path.join(__dirname, 'theme-minimal-coverage.json'));
|
generateTheme('Generated Theme (minimal, coverage)', minimalCoverageColorSet, path.join(__dirname, 'theme-minimal-coverage.json'));
|
||||||
|
|||||||
@@ -14,9 +14,14 @@
|
|||||||
"path": "./theme.json"
|
"path": "./theme.json"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "Generated Theme (Minimal)",
|
"label": "Generated Theme (Minimal, Dark)",
|
||||||
"uiTheme": "vs-dark",
|
"uiTheme": "vs-dark",
|
||||||
"path": "./theme-minimal.json"
|
"path": "./theme-minimal-dark.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Generated Theme (Minimal, Light)",
|
||||||
|
"uiTheme": "vs",
|
||||||
|
"path": "./theme-minimal-light.json"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "Generated Theme (Minimal, coverage)",
|
"label": "Generated Theme (Minimal, coverage)",
|
||||||
|
|||||||
11
src/color.ts
11
src/color.ts
@@ -38,8 +38,9 @@ export function addAlpha(color: string, alpha: number): string {
|
|||||||
return color + alphaHex;
|
return color + alphaHex;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generateFallbackColorSet(s: IBaseColorSet): IColorSet {
|
export function generateFallbackColorSet(s: IBaseColorSet, type: 'light' | 'dark'): IColorSet {
|
||||||
return {
|
return {
|
||||||
|
type,
|
||||||
base: {
|
base: {
|
||||||
background: null,
|
background: null,
|
||||||
foreground: null,
|
foreground: null,
|
||||||
@@ -52,12 +53,12 @@ export function generateFallbackColorSet(s: IBaseColorSet): IColorSet {
|
|||||||
boolean: s.color1,
|
boolean: s.color1,
|
||||||
function: s.color3,
|
function: s.color3,
|
||||||
functionCall: s.color4,
|
functionCall: s.color4,
|
||||||
identifier: lighten(s.color1, 0.5),
|
identifier: (type === 'light' ? darken : lighten)(s.color1, 0.5),
|
||||||
keyword: s.color1,
|
keyword: s.color1,
|
||||||
number: s.color4,
|
number: s.color4,
|
||||||
storage: s.color1,
|
storage: s.color1,
|
||||||
string: s.color2,
|
string: s.color2,
|
||||||
comment: lighten(s.background, 2.0),
|
comment: (type === 'light' ? darken : lighten)(s.background, 2.0),
|
||||||
class: s.color3,
|
class: s.color3,
|
||||||
classMember: s.color3,
|
classMember: s.color3,
|
||||||
type: s.color3,
|
type: s.color3,
|
||||||
@@ -69,8 +70,8 @@ export function generateFallbackColorSet(s: IBaseColorSet): IColorSet {
|
|||||||
},
|
},
|
||||||
ui: {
|
ui: {
|
||||||
cursor: null,
|
cursor: null,
|
||||||
invisibles: lighten(s.background, 0.2),
|
invisibles: (type === 'light' ? darken : lighten)(s.background, 0.2),
|
||||||
guide: lighten(s.background, 0.2),
|
guide: (type === 'light' ? darken : lighten)(s.background, 0.2),
|
||||||
lineHighlight: null,
|
lineHighlight: null,
|
||||||
findMatchHighlight: null,
|
findMatchHighlight: null,
|
||||||
currentFindMatchHighlight: null,
|
currentFindMatchHighlight: null,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ export interface IBaseColorSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IColorSet {
|
export interface IColorSet {
|
||||||
|
type: 'light' | 'dark';
|
||||||
base: IBaseColorSet;
|
base: IBaseColorSet;
|
||||||
syntax?: {
|
syntax?: {
|
||||||
boolean?: string;
|
boolean?: string;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export class VscodeThemeGenerator implements IThemeGenerator {
|
|||||||
if (!colorSet.terminal) colorSet.terminal = {};
|
if (!colorSet.terminal) colorSet.terminal = {};
|
||||||
if (!colorSet.ui) colorSet.ui = {};
|
if (!colorSet.ui) colorSet.ui = {};
|
||||||
|
|
||||||
const fallbackColorSet = generateFallbackColorSet(colorSet.base);
|
const fallbackColorSet = generateFallbackColorSet(colorSet.base, colorSet.type);
|
||||||
|
|
||||||
const theme: IVscodeJsonTheme = {
|
const theme: IVscodeJsonTheme = {
|
||||||
name: name,
|
name: name,
|
||||||
@@ -51,11 +51,11 @@ export class VscodeThemeGenerator implements IThemeGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _applyWorkbenchColors(theme: IVscodeJsonTheme, colorSet: IColorSet): void {
|
private _applyWorkbenchColors(theme: IVscodeJsonTheme, colorSet: IColorSet): void {
|
||||||
const background1 = darken(colorSet.base.background, 0.2);
|
const background1 = (colorSet.type === 'light' ? lighten : darken)(colorSet.base.background, 0.2);
|
||||||
const background2 = colorSet.base.background;
|
const background2 = colorSet.base.background;
|
||||||
const background3 = lighten(colorSet.base.background, 0.2);
|
const background3 = (colorSet.type === 'light' ? darken : lighten)(colorSet.base.background, 0.2);
|
||||||
const background4 = lighten(colorSet.base.background, 0.4);
|
const background4 = (colorSet.type === 'light' ? darken : lighten)(colorSet.base.background, 0.4);
|
||||||
const background5 = lighten(colorSet.base.background, 0.6);
|
const background5 = (colorSet.type === 'light' ? darken : lighten)(colorSet.base.background, 0.6);
|
||||||
|
|
||||||
// Contrast colors
|
// Contrast colors
|
||||||
// contrastActiveBorder: An extra border around active elements to separate them from others for greater contrast.
|
// contrastActiveBorder: An extra border around active elements to separate them from others for greater contrast.
|
||||||
|
|||||||
Reference in New Issue
Block a user