From 99ab6e8d7b0bab5f549c7315d68ce1b299609ae6 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Wed, 8 Mar 2017 23:02:21 +0100 Subject: [PATCH] [theme] conversion script --- build/npm/update-theme.js | 23 +- extensions/theme-abyss/package.json | 2 +- .../theme-abyss/themes/abyss-color-theme.json | 222 ++++++++++++++++++ 3 files changed, 245 insertions(+), 2 deletions(-) create mode 100644 extensions/theme-abyss/themes/abyss-color-theme.json diff --git a/build/npm/update-theme.js b/build/npm/update-theme.js index f3b0e4697b8..c11ef31b940 100644 --- a/build/npm/update-theme.js +++ b/build/npm/update-theme.js @@ -9,6 +9,11 @@ var path = require('path'); var fs = require('fs'); var plist = require('fast-plist'); +var mappings = { + "ansiBlack": ["terminalAnsiBlack"], "ansiRed": ["terminalAnsiRed"], "ansiGreen": ["terminalAnsiGreen"], "ansiYellow": ["terminalAnsiYellow"], "ansiBlue": ["terminalAnsiBlue"], "ansiMagenta": ["terminalAnsiMagenta"], "ansiCyan": ["terminalAnsiCyan"], "ansiWhite": ["terminalAnsiWhite"], "ansiBrightBlack": ["terminalAnsiBrightBlack"], "ansiBrightRed": ["terminalAnsiBrightRed"], "ansiBrightGreen": ["terminalAnsiBrightGreen"], "ansiBrightYellow": ["terminalAnsiBrightYellow"], "ansiBrightBlue": ["terminalAnsiBrightBlue"], "ansiBrightMagenta": ["terminalAnsiBrightMagenta"], "ansiBrightCyan": ["terminalAnsiBrightCyan"], "ansiBrightWhite": ["terminalAnsiBrightWhite"], "background": ["editorBackground"], + "hoverHighlight": ["editorHoverHighlight", "editorHoverHighlight"], "linkForeground": ["editorLinkForeground"], "selection": ["editorSelection"], "inactiveSelection": ["editorInactiveSelection"], "selectionHighlightColor": ["editorSelectionHighlightColor"], "wordHighlight": ["editorWordHighlight"], "wordHighlightStrong": ["editorWordHighlightStrong"], "findMatchHighlight": ["editorFindMatchHighlight", "referencesFindMatchHighlight"], "currentFindMatchHighlight": ["editorCurrentFindMatchHighlight"], "findRangeHighlight": ["editorFindRangeHighlight"], "referenceHighlight": ["referencesReferenceHighlight"], "lineHighlight": ["editorLineHighlight"], "rangeHighlight": ["editorRangeHighlight"], "caret": ["editorCursor"], "invisibles": ["editorInvisibles"], "guide": ["editorGuide"] +}; + exports.update = function (srcName, destName) { try { console.log('reading ', srcName); @@ -17,6 +22,7 @@ exports.update = function (srcName, destName) { let theme = plist.parse(plistContent); let settings = theme.settings; if (Array.isArray(settings)) { + let colorMap = {}; for (let entry of settings) { let scope = entry.scope; if (scope) { @@ -24,10 +30,25 @@ exports.update = function (srcName, destName) { if (parts.length > 1) { entry.scope = parts; } + } else { + var entrySettings = entry.settings; + for (let entry in entrySettings) { + let mapping = mappings[entry]; + if (mapping) { + for (let newKey of mapping) { + colorMap[newKey] = entrySettings[entry]; + } + if (entry !== 'foreground' && entry !== 'background') { + delete entrySettings[entry]; + } + } + } + } } + result.name = theme.name; result.syntaxTokens = settings; - result.colors = {}; + result.colors = colorMap; } fs.writeFileSync(destName, JSON.stringify(result, null, '\t')); } catch (e) { diff --git a/extensions/theme-abyss/package.json b/extensions/theme-abyss/package.json index 7d722f7d239..dd1aa7b31a2 100644 --- a/extensions/theme-abyss/package.json +++ b/extensions/theme-abyss/package.json @@ -8,7 +8,7 @@ { "label": "Abyss", "uiTheme": "vs-dark", - "path": "./themes/Abyss.tmTheme" + "path": "./themes/abyss-color-theme.json" } ] } diff --git a/extensions/theme-abyss/themes/abyss-color-theme.json b/extensions/theme-abyss/themes/abyss-color-theme.json new file mode 100644 index 00000000000..90c6a1c55ad --- /dev/null +++ b/extensions/theme-abyss/themes/abyss-color-theme.json @@ -0,0 +1,222 @@ +{ + "name": "Ofer 1", + "syntaxTokens": [ + { + "settings": { + "background": "#000c18", + "foreground": "#6688cc" + } + }, + { + "name": "Comment", + "scope": "comment", + "settings": { + "foreground": "#223355" + } + }, + { + "name": "String", + "scope": "string", + "settings": { + "foreground": "#22aa44" + } + }, + { + "name": "Number", + "scope": "constant.numeric", + "settings": { + "foreground": "#f280d0" + } + }, + { + "name": "Built-in constant", + "scope": "constant.language", + "settings": { + "foreground": "#f280d0" + } + }, + { + "name": "User-defined constant", + "scope": [ + "constant.character", + "constant.other" + ], + "settings": { + "foreground": "#f280d0" + } + }, + { + "name": "Variable", + "scope": "variable", + "settings": { + "fontStyle": "" + } + }, + { + "name": "Keyword", + "scope": "keyword", + "settings": { + "foreground": "#225588" + } + }, + { + "name": "Storage", + "scope": "storage", + "settings": { + "fontStyle": "", + "foreground": "#225588" + } + }, + { + "name": "Storage type", + "scope": "storage.type", + "settings": { + "fontStyle": "italic", + "foreground": "#9966b8" + } + }, + { + "name": "Class name", + "scope": [ + "entity.name.class", + "entity.name.type" + ], + "settings": { + "fontStyle": "underline", + "foreground": "#ffeebb" + } + }, + { + "name": "Inherited class", + "scope": "entity.other.inherited-class", + "settings": { + "fontStyle": "italic underline", + "foreground": "#ddbb88" + } + }, + { + "name": "Function name", + "scope": "entity.name.function", + "settings": { + "fontStyle": "", + "foreground": "#ddbb88" + } + }, + { + "name": "Function argument", + "scope": "variable.parameter", + "settings": { + "fontStyle": "italic", + "foreground": "#2277ff" + } + }, + { + "name": "Tag name", + "scope": "entity.name.tag", + "settings": { + "fontStyle": "", + "foreground": "#225588" + } + }, + { + "name": "Tag attribute", + "scope": "entity.other.attribute-name", + "settings": { + "fontStyle": "", + "foreground": "#ddbb88" + } + }, + { + "name": "Library function", + "scope": "support.function", + "settings": { + "fontStyle": "", + "foreground": "#9966b8" + } + }, + { + "name": "Library constant", + "scope": "support.constant", + "settings": { + "fontStyle": "", + "foreground": "#9966b8" + } + }, + { + "name": "Library class/type", + "scope": [ + "support.type", + "support.class" + ], + "settings": { + "fontStyle": "italic", + "foreground": "#9966b8" + } + }, + { + "name": "Library variable", + "scope": "support.other.variable", + "settings": { + "fontStyle": "" + } + }, + { + "name": "Invalid", + "scope": "invalid", + "settings": { + "background": "#F92672", + "fontStyle": "", + "foreground": "#F8F8F0" + } + }, + { + "name": "Invalid deprecated", + "scope": "invalid.deprecated", + "settings": { + "background": "#AE81FF", + "foreground": "#F8F8F0" + } + }, + { + "name": "Markup Quote", + "scope": "markup.quote", + "settings": { + "foreground": "#22aa44" + } + }, + { + "name": "Markup Styling", + "scope": [ + "markup.bold", + "markup.italic" + ], + "settings": { + "foreground": "#22aa44" + } + }, + { + "name": "Markup Inline", + "scope": "markup.inline.raw", + "settings": { + "fontStyle": "", + "foreground": "#9966b8" + } + }, + { + "name": "Markup Setext Header", + "scope": "markup.heading.setext", + "settings": { + "fontStyle": "", + "foreground": "#ddbb88" + } + } + ], + "colors": { + "editorBackground": "#000c18", + "editorCursor": "#ddbb88", + "editorInvisibles": "#002040", + "editorLineHighlight": "#082050", + "editorSelection": "#770811", + "editorGuide": "#002952" + } +} \ No newline at end of file -- GitLab