diff --git a/src/generate-pkg-json.js b/src/generate-pkg-json.js index 7da6ed1..c1446e7 100644 --- a/src/generate-pkg-json.js +++ b/src/generate-pkg-json.js @@ -34,6 +34,21 @@ module.exports = themeInfo => ({ label: `Neon Night`, uiTheme: `vs-dark`, path: `./neon-night-theme.json` + }, + { + label: `Neon Night - No Bold`, + uiTheme: `vs-dark`, + path: `./neon-night-no-bold-theme.json` + }, + { + label: `Neon Night - No Italic`, + uiTheme: `vs-dark`, + path: `./neon-night-no-italic-theme.json` + }, + { + label: `Neon Night - No Font Styles`, + uiTheme: `vs-dark`, + path: `./neon-night-no-style-theme.json` } ] }, diff --git a/src/generate-theme.js b/src/generate-theme.js index d9e8c0f..994509b 100644 --- a/src/generate-theme.js +++ b/src/generate-theme.js @@ -39,15 +39,15 @@ const generateTheme = ( }, tokenColors: [ ...require(`./token-colors/base`)(palette, fontStyleEnabled), - ...require(`./token-colors/clojure`)(palette), - ...require(`./token-colors/css`)(palette), - ...require(`./token-colors/docker`)(palette), + ...require(`./token-colors/clojure`)(palette, fontStyleEnabled), + ...require(`./token-colors/css`)(palette, fontStyleEnabled), + ...require(`./token-colors/docker`)(palette, fontStyleEnabled), ...require(`./token-colors/go`)(palette), - ...require(`./token-colors/html`)(palette), - ...require(`./token-colors/javascript`)(palette), - ...require(`./token-colors/json`)(palette), + ...require(`./token-colors/html`)(palette, fontStyleEnabled), + ...require(`./token-colors/javascript`)(palette, fontStyleEnabled), + ...require(`./token-colors/json`)(palette, fontStyleEnabled), ...require(`./token-colors/makefile`)(palette), - ...require(`./token-colors/markdown`)(palette), + ...require(`./token-colors/markdown`)(palette, fontStyleEnabled), ...require(`./token-colors/yaml`)(palette) ] }); diff --git a/src/index.js b/src/index.js index 17e903c..6668d94 100644 --- a/src/index.js +++ b/src/index.js @@ -7,26 +7,25 @@ const pkgJSON = require(`./generate-pkg-json`); const palette = require(`./palette`); const themeInfo = { name: `neon-night`, - displayName: `Neon Night` + displayName: `Neon Night`, + variant: `` }; -const themePath = path.resolve( - __dirname, - `..`, - `themes`, - `${themeInfo.name}-theme.json` -); +const themePath = (variant /*: ?string */) => { + const name = variant ? `${themeInfo.name}-${variant}` : themeInfo.name; + return path.resolve(__dirname, `..`, `themes`, `${name}-theme.json`); +}; const pkgJSONPath = path.resolve(__dirname, `..`, `themes`, `package.json`); -const main = async function(themePath, themeInfo) { +const main = async function(themePath, themeInfo, fontStyleEnabled) { await fs.writeFileSync( - themePath, + themePath(themeInfo.variant), JSON.stringify( generateTheme({ displayName: themeInfo.name, palette, - fontStyleEnabled: true + fontStyleEnabled }), null, 2 @@ -41,4 +40,26 @@ const main = async function(themePath, themeInfo) { ); }; -main(themePath, themeInfo); +// default +main(themePath, themeInfo, { italic: true, bold: true }); + +// no font style +main( + themePath, + { variant: `no-style`, ...themeInfo }, + { italic: false, bold: false } +); + +// no bold style +main( + themePath, + { variant: `no-bold`, ...themeInfo }, + { italic: true, bold: false } +); + +// no italic style +main( + themePath, + { variant: `no-italic`, ...themeInfo }, + { italic: false, bold: true } +); diff --git a/src/token-colors/base.js b/src/token-colors/base.js index eb60e98..e12b3d0 100644 --- a/src/token-colors/base.js +++ b/src/token-colors/base.js @@ -1,15 +1,15 @@ // @flow /* :: -import type {Palette} from '../types' +import type {Palette, FontStyles} from '../types' */ -const base = (palette /*: Palette */, fontStyleEnabled /*: boolean */) => [ +const base = (palette /*: Palette */, fontStyleEnabled /*: FontStyles */) => [ { name: `Base - Comment`, scope: [`comment`, `punctuation.definition.comment`], settings: { - fontStyle: fontStyleEnabled ? `italic` : `normal`, + fontStyle: fontStyleEnabled.italic ? `italic` : `normal`, foreground: palette.magenta77 } }, @@ -25,7 +25,7 @@ const base = (palette /*: Palette */, fontStyleEnabled /*: boolean */) => [ scope: [`entity.name.function`], settings: { foreground: palette.white, - fontStyle: fontStyleEnabled ? `italic` : `normal` + fontStyle: fontStyleEnabled.italic ? `italic` : `normal` } }, { @@ -39,7 +39,7 @@ const base = (palette /*: Palette */, fontStyleEnabled /*: boolean */) => [ name: `Base - Boolean`, scope: `constant.language.boolean`, settings: { - fontStyle: fontStyleEnabled ? `bold` : `normal`, + fontStyle: fontStyleEnabled.bold ? `bold` : `normal`, foreground: palette.white } }, @@ -61,7 +61,7 @@ const base = (palette /*: Palette */, fontStyleEnabled /*: boolean */) => [ name: `Base - Storage`, scope: [`storage.type`, `storage.modifier`], settings: { - fontStyle: fontStyleEnabled ? `italic` : `normal`, + fontStyle: fontStyleEnabled.italic ? `italic` : `normal`, foreground: palette.magenta } }, @@ -82,7 +82,7 @@ const base = (palette /*: Palette */, fontStyleEnabled /*: boolean */) => [ `keyword.control` ], settings: { - fontStyle: fontStyleEnabled ? `italic` : `normal`, + fontStyle: fontStyleEnabled.italic ? `italic` : `normal`, foreground: palette.magenta } }, @@ -111,7 +111,7 @@ const base = (palette /*: Palette */, fontStyleEnabled /*: boolean */) => [ name: `Base - Language Variable`, scope: [`variable.language`], settings: { - fontStyle: fontStyleEnabled ? `bold` : `normal`, + fontStyle: fontStyleEnabled.bold ? `bold` : `normal`, foreground: palette.white } }, @@ -119,7 +119,7 @@ const base = (palette /*: Palette */, fontStyleEnabled /*: boolean */) => [ name: `Base - Attributes`, scope: [`entity.other.attribute-name`], settings: { - fontStyle: fontStyleEnabled ? `italic` : `normal`, + fontStyle: fontStyleEnabled.italic ? `italic` : `normal`, foreground: palette.magenta } }, diff --git a/src/token-colors/clojure.js b/src/token-colors/clojure.js index b645017..090d369 100644 --- a/src/token-colors/clojure.js +++ b/src/token-colors/clojure.js @@ -1,10 +1,13 @@ // @flow /* :: -import type {Palette} from '../types' +import type {Palette, FontStyles} from '../types' */ -const clojure = (palette /*: Palette */) => [ +const clojure = ( + palette /*: Palette */, + fontStyleEnabled /*: FontStyles */ +) => [ { name: `Clojure - Constant Keyword`, scope: `source.clojure constant.keyword`, @@ -24,7 +27,7 @@ const clojure = (palette /*: Palette */) => [ scope: `source.clojure meta.symbol`, settings: { foreground: palette.cyan, - fontStyle: `italic` + fontStyle: fontStyleEnabled.italic ? `italic` : `normal` } } ]; diff --git a/src/token-colors/css.js b/src/token-colors/css.js index 78471cb..e55104a 100644 --- a/src/token-colors/css.js +++ b/src/token-colors/css.js @@ -1,10 +1,10 @@ // @flow /* :: -import type {Palette} from '../types' +import type {Palette, FontStyles} from '../types' */ -const css = (palette /*: Palette */) => [ +const css = (palette /*: Palette */, fontStyleEnabled /*: FontStyles */) => [ { name: `CSS - ID`, scope: [ @@ -17,7 +17,7 @@ const css = (palette /*: Palette */) => [ ], settings: { foreground: palette.magenta, - fontStyle: `italic` + fontStyle: fontStyleEnabled.italic ? `italic` : `normal` } }, { diff --git a/src/token-colors/docker.js b/src/token-colors/docker.js index 442ed0a..0957858 100644 --- a/src/token-colors/docker.js +++ b/src/token-colors/docker.js @@ -1,16 +1,16 @@ // @flow /* :: -import type {Palette} from '../types' +import type {Palette, FontStyles} from '../types' */ -const docker = (palette /*: Palette */) => [ +const docker = (palette /*: Palette */, fontStyleEnabled /*: FontStyles */) => [ { name: `Dockerfile - Instruction`, scope: `source.dockerfile keyword.other.special-method`, settings: { foreground: palette.magenta, - fontStyle: `bold` + fontStyle: fontStyleEnabled.bold ? `bold` : `normal` } } ]; diff --git a/src/token-colors/html.js b/src/token-colors/html.js index 6ae82f4..3861171 100644 --- a/src/token-colors/html.js +++ b/src/token-colors/html.js @@ -1,10 +1,10 @@ // @flow /* :: -import type {Palette} from '../types' +import type {Palette, FontStyles} from '../types' */ -const html = (palette /*: Palette */) => [ +const html = (palette /*: Palette */, fontStyleEnabled /*: FontStyles */) => [ { name: `HTML - Tag`, scope: `text.html entity.name.tag`, @@ -23,7 +23,7 @@ const html = (palette /*: Palette */) => [ name: `HTML - Doctype`, scope: `text.html meta.tag.metadata.doctype`, settings: { - fontStyle: `bold` + fontStyle: fontStyleEnabled.bold ? `bold` : `normal` } } ]; diff --git a/src/token-colors/javascript.js b/src/token-colors/javascript.js index 5047257..1a2395f 100644 --- a/src/token-colors/javascript.js +++ b/src/token-colors/javascript.js @@ -1,10 +1,13 @@ // @flow /* :: -import type {Palette} from '../types' +import type {Palette, FontStyles} from '../types' */ -const javascript = (palette /*: Palette */) => [ +const javascript = ( + palette /*: Palette */, + fontStyleEnabled /*: FontStyles */ +) => [ { name: `JS - Import/Require`, scope: `source.js keyword.control.module`, @@ -24,7 +27,7 @@ const javascript = (palette /*: Palette */) => [ scope: `source.js string.unquoted`, settings: { foreground: palette.white, - fontStyle: `italic` + fontStyle: fontStyleEnabled.italic ? `italic` : `normal` } }, { @@ -50,7 +53,7 @@ const javascript = (palette /*: Palette */) => [ scope: `source.js support.type.class.flowtype`, settings: { foreground: palette.white, - fontStyle: `bold` + fontStyle: fontStyleEnabled.bold ? `bold` : `normal` } }, { @@ -62,7 +65,7 @@ const javascript = (palette /*: Palette */) => [ ], settings: { foreground: palette.white, - fontStyle: `bold` + fontStyle: fontStyleEnabled.bold ? `bold` : `normal` } }, { @@ -70,7 +73,7 @@ const javascript = (palette /*: Palette */) => [ scope: `source.js variable.language`, settings: { foreground: palette.white, - fontStyle: `bold` + fontStyle: fontStyleEnabled.bold ? `bold` : `normal` } }, { @@ -92,7 +95,7 @@ const javascript = (palette /*: Palette */) => [ scope: `source.js entity.other.attribute-name.jsx`, settings: { foreground: palette.blue, - fontStyle: `italic` + fontStyle: fontStyleEnabled.italic ? `italic` : `normal` } } ]; diff --git a/src/token-colors/json.js b/src/token-colors/json.js index e85c732..403794d 100644 --- a/src/token-colors/json.js +++ b/src/token-colors/json.js @@ -1,10 +1,10 @@ // @flow /* :: -import type {Palette} from '../types' +import type {Palette, FontStyles} from '../types' */ -const json = (palette /*: Palette */) => [ +const json = (palette /*: Palette */, fontStyleEnabled /*: FontStyles */) => [ { name: `JSON - Property Name`, scope: [ @@ -20,7 +20,7 @@ const json = (palette /*: Palette */) => [ scope: `source.json constant.language`, settings: { foreground: palette.white, - fontStyle: `bold` + fontStyle: fontStyleEnabled.bold ? `bold` : `normal` } }, { diff --git a/src/token-colors/markdown.js b/src/token-colors/markdown.js index 7c28887..7ae6149 100644 --- a/src/token-colors/markdown.js +++ b/src/token-colors/markdown.js @@ -1,10 +1,13 @@ // @flow /* :: -import type {Palette} from '../types' +import type {Palette, FontStyles} from '../types' */ -const markdown = (palette /*: Palette */) => [ +const markdown = ( + palette /*: Palette */, + fontStyleEnabled /*: FontStyles */ +) => [ { name: `Markdown - Plain`, scope: [`text.html.markdown`, `punctuation.definition.list_item.markdown`], @@ -20,7 +23,7 @@ const markdown = (palette /*: Palette */) => [ ], settings: { foreground: palette.blue, - fontStyle: `bold` + fontStyle: fontStyleEnabled.bold ? `bold` : `normal` } }, { @@ -122,7 +125,7 @@ const markdown = (palette /*: Palette */) => [ name: `Markdown - Separator`, scope: [`text.html markdown meta.separator`], settings: { - fontStyle: `bold`, + fontStyle: fontStyleEnabled.bold ? `bold` : `normal`, foreground: palette.white } } diff --git a/src/types.js b/src/types.js index cae5c94..6d46523 100644 --- a/src/types.js +++ b/src/types.js @@ -26,6 +26,11 @@ export type Palette = {| export type Theme = {| displayName: string, - fontStyleEnabled: boolean, + fontStyleEnabled: FontStyles, palette: Palette |}; + +export type FontStyles = {| + italic: boolean, + bold: boolean +|};