mirror of
https://github.com/Tyriar/vscode-theme-generator.git
synced 2025-12-07 09:36:11 -08:00
Expose an API
This commit is contained in:
73
demo/generate.js
Normal file
73
demo/generate.js
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
"use strict";
|
||||||
|
var path = require('path');
|
||||||
|
var dist_1 = require('../dist');
|
||||||
|
var sapphireColors = {
|
||||||
|
red: '#DA6771',
|
||||||
|
redLight: '#e5949b',
|
||||||
|
green: '#4EB071',
|
||||||
|
greenDim: '#275839',
|
||||||
|
yellow: '#fff099',
|
||||||
|
blue: '#399EF4',
|
||||||
|
blueLight: '#9fcff9',
|
||||||
|
pink: '#B168DF',
|
||||||
|
teal: '#21C5C7',
|
||||||
|
grey: '#4A5160'
|
||||||
|
};
|
||||||
|
var sapphireColorSet = {
|
||||||
|
syntax: {
|
||||||
|
identifier: sapphireColors.blueLight,
|
||||||
|
string: sapphireColors.red,
|
||||||
|
number: sapphireColors.redLight,
|
||||||
|
keyword: sapphireColors.blue,
|
||||||
|
boolean: sapphireColors.blue,
|
||||||
|
function: sapphireColors.teal,
|
||||||
|
functionCall: sapphireColors.yellow,
|
||||||
|
storage: sapphireColors.blue,
|
||||||
|
comment: sapphireColors.grey,
|
||||||
|
class: sapphireColors.teal,
|
||||||
|
classMember: sapphireColors.teal,
|
||||||
|
type: sapphireColors.green,
|
||||||
|
this: sapphireColors.blue,
|
||||||
|
cssClass: sapphireColors.blue,
|
||||||
|
cssId: sapphireColors.red,
|
||||||
|
cssTag: sapphireColors.teal,
|
||||||
|
markdownQuote: '#c0c0c0'
|
||||||
|
},
|
||||||
|
ui: {
|
||||||
|
background: '#12171f',
|
||||||
|
foreground: '#efefef',
|
||||||
|
accent: '#0a0d12',
|
||||||
|
cursor: '#ffffff',
|
||||||
|
guide: '#263040',
|
||||||
|
invisibles: '#263040',
|
||||||
|
rangeHighlight: '#263040',
|
||||||
|
// Bright red 50% opacity
|
||||||
|
findMatchHighlight: '#cb606080',
|
||||||
|
// Brighter red 50% opacity
|
||||||
|
currentFindMatchHighlight: '#ff777780',
|
||||||
|
selection: '#153958',
|
||||||
|
// Blue 50% opacity
|
||||||
|
selectionHighlight: '#2b74b380',
|
||||||
|
// White with ~10% opacity
|
||||||
|
wordHighlight: '#ffffff18',
|
||||||
|
wordHighlightStrong: '#ffffff18',
|
||||||
|
activeLinkForeground: sapphireColors.blue,
|
||||||
|
ansiBlack: '#666666',
|
||||||
|
ansiRed: sapphireColors.red,
|
||||||
|
ansiGreen: sapphireColors.green,
|
||||||
|
ansiYellow: sapphireColors.yellow,
|
||||||
|
ansiBlue: sapphireColors.blue,
|
||||||
|
ansiMagenta: sapphireColors.pink,
|
||||||
|
ansiCyan: sapphireColors.teal,
|
||||||
|
ansiWhite: '#efefef',
|
||||||
|
ansiBrightBlack: '#666666',
|
||||||
|
ansiBrightRed: sapphireColors.red,
|
||||||
|
ansiBrightGreen: sapphireColors.green,
|
||||||
|
ansiBrightYellow: sapphireColors.yellow,
|
||||||
|
ansiBrightBlue: sapphireColors.blue,
|
||||||
|
ansiBrightMagenta: sapphireColors.pink,
|
||||||
|
ansiBrightCyan: sapphireColors.teal,
|
||||||
|
ansiBrightWhite: '#efefef'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
dist_1.generateTheme('Sapphire theme', sapphireColorSet, path.join(__dirname, 'theme.json'));
|
||||||
76
demo/generate.ts
Normal file
76
demo/generate.ts
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
import * as path from 'path';
|
||||||
|
import { generateTheme, IColorSet } from '../dist';
|
||||||
|
|
||||||
|
const sapphireColors = {
|
||||||
|
red: '#DA6771',
|
||||||
|
redLight: '#e5949b',
|
||||||
|
green: '#4EB071',
|
||||||
|
greenDim: '#275839',
|
||||||
|
yellow: '#fff099',
|
||||||
|
blue: '#399EF4',
|
||||||
|
blueLight: '#9fcff9',
|
||||||
|
pink: '#B168DF',
|
||||||
|
teal: '#21C5C7',
|
||||||
|
grey: '#4A5160'
|
||||||
|
}
|
||||||
|
|
||||||
|
const sapphireColorSet: IColorSet = {
|
||||||
|
syntax: {
|
||||||
|
identifier: sapphireColors.blueLight,
|
||||||
|
string: sapphireColors.red,
|
||||||
|
number: sapphireColors.redLight,
|
||||||
|
keyword: sapphireColors.blue,
|
||||||
|
boolean: sapphireColors.blue,
|
||||||
|
function: sapphireColors.teal,
|
||||||
|
functionCall: sapphireColors.yellow,
|
||||||
|
storage: sapphireColors.blue,
|
||||||
|
comment: sapphireColors.grey,
|
||||||
|
class: sapphireColors.teal,
|
||||||
|
classMember: sapphireColors.teal,
|
||||||
|
type: sapphireColors.green,
|
||||||
|
this: sapphireColors.blue,
|
||||||
|
cssClass: sapphireColors.blue,
|
||||||
|
cssId: sapphireColors.red,
|
||||||
|
cssTag: sapphireColors.teal,
|
||||||
|
markdownQuote: '#c0c0c0'
|
||||||
|
},
|
||||||
|
ui: {
|
||||||
|
background: '#12171f',
|
||||||
|
foreground: '#efefef',
|
||||||
|
accent: '#0a0d12',
|
||||||
|
cursor: '#ffffff',
|
||||||
|
guide: '#263040',
|
||||||
|
invisibles: '#263040',
|
||||||
|
rangeHighlight: '#263040',
|
||||||
|
// Bright red 50% opacity
|
||||||
|
findMatchHighlight: '#cb606080',
|
||||||
|
// Brighter red 50% opacity
|
||||||
|
currentFindMatchHighlight: '#ff777780',
|
||||||
|
selection: '#153958',
|
||||||
|
// Blue 50% opacity
|
||||||
|
selectionHighlight: '#2b74b380',
|
||||||
|
// White with ~10% opacity
|
||||||
|
wordHighlight: '#ffffff18',
|
||||||
|
wordHighlightStrong: '#ffffff18',
|
||||||
|
activeLinkForeground: sapphireColors.blue,
|
||||||
|
|
||||||
|
ansiBlack: '#666666',
|
||||||
|
ansiRed: sapphireColors.red,
|
||||||
|
ansiGreen: sapphireColors.green,
|
||||||
|
ansiYellow: sapphireColors.yellow,
|
||||||
|
ansiBlue: sapphireColors.blue,
|
||||||
|
ansiMagenta: sapphireColors.pink,
|
||||||
|
ansiCyan: sapphireColors.teal,
|
||||||
|
ansiWhite: '#efefef',
|
||||||
|
ansiBrightBlack: '#666666',
|
||||||
|
ansiBrightRed: sapphireColors.red,
|
||||||
|
ansiBrightGreen: sapphireColors.green,
|
||||||
|
ansiBrightYellow: sapphireColors.yellow,
|
||||||
|
ansiBrightBlue: sapphireColors.blue,
|
||||||
|
ansiBrightMagenta: sapphireColors.pink,
|
||||||
|
ansiBrightCyan: sapphireColors.teal,
|
||||||
|
ansiBrightWhite: '#efefef'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
generateTheme('Sapphire theme', sapphireColorSet, path.join(__dirname, 'theme.json'));
|
||||||
1
demo/theme.json
Normal file
1
demo/theme.json
Normal file
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "theme-generator",
|
"name": "vscode-theme-generator",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "Generates editor/terminal themes using a set of colors",
|
"description": "Easily generate themes for VS Code with only a few colors",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
|
|||||||
77
src/index.ts
77
src/index.ts
@@ -42,78 +42,9 @@ const glacierColorSet: IColorSet = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const sapphireColors = {
|
export function generateTheme(themeName: string, colorSet: IColorSet, outputFile: string) {
|
||||||
red: '#DA6771',
|
const themeJson = new VscodeThemeGenerator().generateTheme(themeName, colorSet);
|
||||||
redLight: '#e5949b',
|
fs.writeFileSync(outputFile, themeJson);
|
||||||
green: '#4EB071',
|
|
||||||
greenDim: '#275839',
|
|
||||||
yellow: '#fff099',
|
|
||||||
blue: '#399EF4',
|
|
||||||
blueLight: '#9fcff9',
|
|
||||||
pink: '#B168DF',
|
|
||||||
teal: '#21C5C7',
|
|
||||||
grey: '#4A5160'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const sapphireColorSet: IColorSet = {
|
export { IColorSet } from './themeGenerator';
|
||||||
syntax: {
|
|
||||||
identifier: sapphireColors.blueLight,
|
|
||||||
string: sapphireColors.red,
|
|
||||||
number: sapphireColors.redLight,
|
|
||||||
keyword: sapphireColors.blue,
|
|
||||||
boolean: sapphireColors.blue,
|
|
||||||
function: sapphireColors.teal,
|
|
||||||
functionCall: sapphireColors.yellow,
|
|
||||||
storage: sapphireColors.blue,
|
|
||||||
comment: sapphireColors.grey,
|
|
||||||
class: sapphireColors.teal,
|
|
||||||
classMember: sapphireColors.teal,
|
|
||||||
type: sapphireColors.green,
|
|
||||||
this: sapphireColors.blue,
|
|
||||||
cssClass: sapphireColors.blue,
|
|
||||||
cssId: sapphireColors.red,
|
|
||||||
cssTag: sapphireColors.teal,
|
|
||||||
markdownQuote: '#c0c0c0'
|
|
||||||
},
|
|
||||||
ui: {
|
|
||||||
background: '#12171f',
|
|
||||||
foreground: '#efefef',
|
|
||||||
accent: '#0a0d12',
|
|
||||||
cursor: '#ffffff',
|
|
||||||
guide: '#263040',
|
|
||||||
invisibles: '#263040',
|
|
||||||
rangeHighlight: '#263040',
|
|
||||||
// Bright red 50% opacity
|
|
||||||
findMatchHighlight: '#cb606080',
|
|
||||||
// Brighter red 50% opacity
|
|
||||||
currentFindMatchHighlight: '#ff777780',
|
|
||||||
selection: '#153958',
|
|
||||||
// Blue 50% opacity
|
|
||||||
selectionHighlight: '#2b74b380',
|
|
||||||
// White with ~10% opacity
|
|
||||||
wordHighlight: '#ffffff18',
|
|
||||||
wordHighlightStrong: '#ffffff18',
|
|
||||||
activeLinkForeground: sapphireColors.blue,
|
|
||||||
|
|
||||||
ansiBlack: '#666666',
|
|
||||||
ansiRed: sapphireColors.red,
|
|
||||||
ansiGreen: sapphireColors.green,
|
|
||||||
ansiYellow: sapphireColors.yellow,
|
|
||||||
ansiBlue: sapphireColors.blue,
|
|
||||||
ansiMagenta: sapphireColors.pink,
|
|
||||||
ansiCyan: sapphireColors.teal,
|
|
||||||
ansiWhite: '#efefef',
|
|
||||||
ansiBrightBlack: '#666666',
|
|
||||||
ansiBrightRed: sapphireColors.red,
|
|
||||||
ansiBrightGreen: sapphireColors.green,
|
|
||||||
ansiBrightYellow: sapphireColors.yellow,
|
|
||||||
ansiBrightBlue: sapphireColors.blue,
|
|
||||||
ansiBrightMagenta: sapphireColors.pink,
|
|
||||||
ansiBrightCyan: sapphireColors.teal,
|
|
||||||
ansiBrightWhite: '#efefef'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const themeJson = new VscodeThemeGenerator().generateTheme('Sapphire theme', sapphireColorSet);
|
|
||||||
const outputFile = path.join(__dirname, '..', 'out', 'theme.json')
|
|
||||||
|
|
||||||
fs.writeFileSync(outputFile, themeJson);
|
|
||||||
|
|||||||
Reference in New Issue
Block a user