├── .gitignore ├── .vscode └── settings.json ├── README.md ├── package.json ├── postcss.config.js ├── public └── index.html ├── src ├── App.js ├── Code.js ├── constants.js ├── elements.js ├── index.js ├── logo.js ├── make-theme │ ├── collectStyles.js │ ├── highlighterTheme.js │ ├── index.js │ ├── minify.js │ ├── nightOwl.js │ ├── scopeMapper.js │ ├── scopeScore.js │ ├── template.js │ └── transformSettings.js └── styles.css ├── tailwind.config.js └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | build -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "git.ignoreLimitWarning": true 3 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # prism-theme-converter 2 | Created with CodeSandbox 3 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prism-theme-generator", 3 | "version": "1.0.0", 4 | "description": "", 5 | "keywords": [], 6 | "main": "src/index.js", 7 | "dependencies": { 8 | "css": "^3.0.0", 9 | "decomment": "0.9.2", 10 | "is-equal": "1.6.1", 11 | "prism-react-renderer": "1.0.2", 12 | "react": "16.12.0", 13 | "react-dom": "16.12.0", 14 | "react-scripts": "3.0.1", 15 | "react-use-clipboard": "1.0.0", 16 | "styled-components": "5.1.0", 17 | "to-camel-case": "^1.0.0" 18 | }, 19 | "devDependencies": { 20 | "typescript": "3.3.3" 21 | }, 22 | "scripts": { 23 | "start": "react-scripts start", 24 | "build": "react-scripts build", 25 | "test": "react-scripts test --env=jsdom", 26 | "eject": "react-scripts eject" 27 | }, 28 | "browserslist": [ 29 | ">0.2%", 30 | "not dead", 31 | "not ie <= 11", 32 | "not op_mini all" 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | require("tailwindcss"), 4 | require("autoprefixer"), 5 | require("postcss-import") 6 | ] 7 | }; 8 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 18 | 22 | 23 | 27 | 32 | 33 | 42 | VSCode to Prism Themes 43 | 44 | 45 | 46 | 47 |
48 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import React, { useState, useRef } from "react"; 2 | import { makeTheme } from "./make-theme"; 3 | import decomment from "decomment"; 4 | import Code from "./Code"; 5 | import Logo from "./logo"; 6 | import "styled-components/macro"; 7 | 8 | import { InputArea, Main, Textarea } from "./elements"; 9 | 10 | import { PLACEHOLDER, GET_THEME, BUTTON_STYLES } from "./constants"; 11 | 12 | export default function App() { 13 | const textarea = useRef(); 14 | const [tab, setTab] = useState("prism"); 15 | const [theme, setTheme] = useState(); 16 | const [error, setError] = useState(false); 17 | const [vsCodeTheme, setVSCodeTheme] = useState(""); 18 | 19 | const createPrismTheme = () => { 20 | setError(false); 21 | let t = ""; 22 | try { 23 | // eslint-disable-next-line 24 | t = eval("(" + decomment(vsCodeTheme) + ")"); 25 | } catch (e) { 26 | setError(true); 27 | return setTheme(` 28 | // not a valid VSCode Theme 29 | `); 30 | } 31 | 32 | if (!t || t.$schema !== "vscode://schemas/color-theme") { 33 | setError(true); 34 | return setTheme(` 35 | // not a valid VSCode Theme 36 | `); 37 | } else { 38 | setTheme(makeTheme(t)); 39 | } 40 | }; 41 | 42 | return ( 43 |
44 | 45 | 46 |
47 |