Skip to content

Commit

Permalink
Merge pull request #21 from wesbos/master
Browse files Browse the repository at this point in the history
Use JSON5 for theme reading
  • Loading branch information
kitten committed Dec 14, 2018
2 parents 86c0572 + aa4e687 commit 6f367ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion tools/themeFromVsCode/package.json
Expand Up @@ -6,7 +6,8 @@
"private": true,
"dependencies": {
"color": "^3.0.0",
"is-equal": "^1.5.5"
"is-equal": "^1.5.5",
"json5": "^2.1.0"
},
"scripts": {
"start": "node ./src/index.js"
Expand Down
11 changes: 7 additions & 4 deletions tools/themeFromVsCode/src/index.js
@@ -1,17 +1,20 @@
const { writeFileSync } = require('fs');
const { writeFileSync, readFileSync } = require('fs');
const JSON5 = require('json5');
const { collectAllSettings } = require('./collectStyles');
const { makeOutput } = require('./template');

// Input
const theme = require('../theme.json');
const themeString = readFileSync('./theme.json');
const theme = JSON5.parse(themeString);

const prismTheme = collectAllSettings(theme.tokenColors);

const json = {
plain: {
color: theme.colors['editor.foreground'],
backgroundColor: theme.colors['editor.background']
backgroundColor: theme.colors['editor.background'],
},
...prismTheme
...prismTheme,
};

const output = makeOutput(json);
Expand Down

0 comments on commit 6f367ef

Please sign in to comment.