Expose an API

This commit is contained in:
Daniel Imms
2017-03-22 22:16:53 -07:00
parent 5112497e6f
commit 2d895b1e18
5 changed files with 156 additions and 75 deletions

73
demo/generate.js Normal file
View 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
View 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

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
{
"name": "theme-generator",
"name": "vscode-theme-generator",
"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",
"scripts": {
"build": "tsc",

View File

@@ -42,78 +42,9 @@ const glacierColorSet: IColorSet = {
}
};
const sapphireColors = {
red: '#DA6771',
redLight: '#e5949b',
green: '#4EB071',
greenDim: '#275839',
yellow: '#fff099',
blue: '#399EF4',
blueLight: '#9fcff9',
pink: '#B168DF',
teal: '#21C5C7',
grey: '#4A5160'
export function generateTheme(themeName: string, colorSet: IColorSet, outputFile: string) {
const themeJson = new VscodeThemeGenerator().generateTheme(themeName, colorSet);
fs.writeFileSync(outputFile, themeJson);
}
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'
}
};
const themeJson = new VscodeThemeGenerator().generateTheme('Sapphire theme', sapphireColorSet);
const outputFile = path.join(__dirname, '..', 'out', 'theme.json')
fs.writeFileSync(outputFile, themeJson);
export { IColorSet } from './themeGenerator';