From 4bfc4e2dc09327099170b5d16e2ad60d4808f774 Mon Sep 17 00:00:00 2001 From: Daniel Smith Date: Fri, 5 Oct 2018 18:01:08 -0400 Subject: [PATCH 1/4] Add API information to README.md --- README.md | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/README.md b/README.md index e41ed50..aaa8c6a 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,77 @@ npm install Make your changes to the colors in index.ts and hit F5 to build the theme and launch a new VS Code window with your theme available in the command palette (`ctrl`/`cmd+shift+p` > "Color Theme"). +## Advanced use + +In addition to the `base` colors, `IColorSet` provides more options for `syntax`, `ui`, and `terminal`. There is also an `overrides` property, which allows you to set any color key from the [Theme Color Reference](https://code.visualstudio.com/docs/getstarted/theme-color-reference) directly. + +Since the theme is defined in TypeScript, you can create an object to give names to colors you want to re-use. + +```ts +const colors = { + red: '#DA6771', + green: '#4EB071', + yellow: '#FFF099', + blue: '#399EF4', + blueLight: '#9FCFF9' +} + +const colorSet: IColorSet = { + base: { + background: '#12171F', + foreground: '#EFEFEF', + color1: colors.blue, + color2: colors.red, + color3: colors.green, + color4: colors.yellow + }, + syntax: { + identifier: colors.blueLight, + string: colors.red + }, + ui: { + cursor: '#FFFFFF' + }, + terminal: { + blue: colors.blue, + brightBlue: colors.blueLight + }, + overrides: { + 'editorGutter.modifiedBackground': colors.green, + 'editorGutter.addedBackground': colors.blue, + 'editorGutter.deletedBackground': colors.red + } +}; +``` + +The `syntax` properties present a simplified set of token types. If not set, these will be derived from the base colors: + +- `color1` determines `boolean`, `identifier`, `keyword`, `storage`, and `cssClass` +- `color2` determines `string` and `cssId` +- `color3` determines `function`, `class`, `classMember`, `type`, and `cssTag` +- `color4` determines `functionCall` and `number` + +By default, `comment` is derived from the `background` color, and `modifier` and `markdownQuote` are not set. + +The `ui` properties allow you to set colors for various highlights and a few other things: + +- `cursor`: the cursor color +- `invisibles`: used for visible whitespace (see the `editor.renderWhitespace` VS Code setting) +- `guide`: indentation guidlines in the editor pane +- `lineHighlight`: colors the line your cursor is on, in place of the boundary lines +- `findMatchHighlight` and `currentFindMatchHighlight`: higlights matches from the find widget +- `findRangeHighlight`: highlights the selected area for "find in selection" +- `rangeHighlight`: background for a selected range of lines +- `selection`: highlights text selected with the cursor +- `selectionHighlight`: highlights text which matches the selected text +- `wordHighlight`: when the cursor is on a symbol, highlights places that symbol is read +- `wordHighlightStrong`: when the cursor is on a symbol, highlights places that symbol is written +- `activeLinkForeground`: color of hyperlinks when clicked + +By default, `invisibles` and `guide` are derived from the `background` color, and the rest are not set. + +The `terminal` properties include each of the standard 16 ANSI colors (`black`, `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, and `white`, plus their "bright" counterparts). To set the background color, add the `terminal.background` key under `overrides`. + ## Support Support below means that the standard VS Code grammar has explicit support for the languages, ie. the colors should match their meanings. Other languages will probably still look alright but there is no guarentee that they will. From 17bc217e35118af80ef59e64e327febcec739514 Mon Sep 17 00:00:00 2001 From: Daniel Smith Date: Sat, 6 Oct 2018 14:03:35 -0400 Subject: [PATCH 2/4] Fix typos --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index aaa8c6a..adb6620 100644 --- a/README.md +++ b/README.md @@ -105,9 +105,9 @@ The `ui` properties allow you to set colors for various highlights and a few oth - `cursor`: the cursor color - `invisibles`: used for visible whitespace (see the `editor.renderWhitespace` VS Code setting) -- `guide`: indentation guidlines in the editor pane +- `guide`: indentation guidelines in the editor pane - `lineHighlight`: colors the line your cursor is on, in place of the boundary lines -- `findMatchHighlight` and `currentFindMatchHighlight`: higlights matches from the find widget +- `findMatchHighlight` and `currentFindMatchHighlight`: highlights matches from the find widget - `findRangeHighlight`: highlights the selected area for "find in selection" - `rangeHighlight`: background for a selected range of lines - `selection`: highlights text selected with the cursor @@ -122,7 +122,7 @@ The `terminal` properties include each of the standard 16 ANSI colors (`black`, ## Support -Support below means that the standard VS Code grammar has explicit support for the languages, ie. the colors should match their meanings. Other languages will probably still look alright but there is no guarentee that they will. +Support below means that the standard VS Code grammar has explicit support for the languages, ie. the colors should match their meanings. Other languages will probably still look alright but there is no guarantee that they will. - :white_check_mark: C# - :white_check_mark: CSS From 110248b2661572c45da0ff173a9a35d07d9de6a5 Mon Sep 17 00:00:00 2001 From: Daniel Smith Date: Sat, 6 Oct 2018 14:05:44 -0400 Subject: [PATCH 3/4] Make second example complete --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index adb6620..a7fb2b1 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,8 @@ In addition to the `base` colors, `IColorSet` provides more options for `syntax` Since the theme is defined in TypeScript, you can create an object to give names to colors you want to re-use. ```ts +import { generateTheme, IColorSet } from 'vscode-theme-generator'; + const colors = { red: '#DA6771', green: '#4EB071', @@ -90,6 +92,8 @@ const colorSet: IColorSet = { 'editorGutter.deletedBackground': colors.red } }; + +generateTheme('My Theme', colorSet, path.join(__dirname, 'theme.json')); ``` The `syntax` properties present a simplified set of token types. If not set, these will be derived from the base colors: From 588930bcd6333e5e956c20e7a5759f3a4a5d7dff Mon Sep 17 00:00:00 2001 From: Daniel Smith Date: Sun, 7 Oct 2018 15:19:15 -0400 Subject: [PATCH 4/4] Add `stringEscape` to `syntax` section of README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a7fb2b1..0aa8e67 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ generateTheme('My Theme', colorSet, path.join(__dirname, 'theme.json')); The `syntax` properties present a simplified set of token types. If not set, these will be derived from the base colors: - `color1` determines `boolean`, `identifier`, `keyword`, `storage`, and `cssClass` -- `color2` determines `string` and `cssId` +- `color2` determines `string`, `stringEscape`, and `cssId` - `color3` determines `function`, `class`, `classMember`, `type`, and `cssTag` - `color4` determines `functionCall` and `number`