-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
75,446 additions
and
62,330 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
const fs = require("fs"); | ||
const {parse} = require("jsonc-parser"); | ||
|
||
let light_content = fs.readFileSync("../jsonc/lightUI.jsonc", "utf-8"),dark_content = fs.readFileSync("../jsonc/darkUI.jsonc", "utf-8"), syntax_content = fs.readFileSync("../jsonc/syntax.jsonc", "utf-8"); | ||
|
||
let light = parse(light_content), dark = parse(dark_content), syntax = parse(syntax_content); | ||
|
||
console.log("light========",light); | ||
// let light = require('../json/lightUI.json'), dark = require('../json/darkUI.json'), syntax = require('../json/syntax.json'); | ||
|
||
let output = { | ||
"Eva-Light": {}, | ||
"Eva-Light-Italic": {}, | ||
"Eva-Light-Bold": {}, | ||
"Eva-Light-Italic-Bold": {}, | ||
"Eva-Dark": {}, | ||
"Eva-Dark-Italic": {}, | ||
"Eva-Dark-Bold": {}, | ||
"Eva-Dark-Italic-Bold": {}, | ||
}; | ||
|
||
for (let i in output) { | ||
if (i.indexOf("Light") > -1) { | ||
light.name = i.replace(/-/g, " "); | ||
output[i] = { ...light, type: "light", tokenColors:scope2token("light",i) }; | ||
} else { | ||
dark.name = i.replace(/-/g, " "); | ||
output[i] = { ...dark, type: "dark", tokenColors:scope2token("dark",i) }; | ||
} | ||
} | ||
|
||
console.log("output========",output); | ||
|
||
|
||
function scope2token(type,file) { | ||
let token = []; | ||
file = type == 'light' ? file.replace('-Light', '') : file.replace('-Dark', ''); | ||
for (let i in syntax) { | ||
let obj = { | ||
name: syntax[i].name, | ||
scope: i, | ||
settings: { | ||
foreground: syntax[i].foreground[type], | ||
fontStyle: syntax[i].fontStyle[file] || '', | ||
}, | ||
}; | ||
token.push(obj); | ||
} | ||
return token; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<script> | ||
// const fs = require("fs"); | ||
// const {parse} = require("jsonc-parser"); | ||
|
||
// let light_content = fs.readFileSync("../jsonc/lightUI.jsonc", "utf-8"),dark_content = fs.readFileSync("../jsonc/darkUI.jsonc", "utf-8"), syntax_content = fs.readFileSync("../jsonc/syntax.jsonc", "utf-8"); | ||
|
||
// let light = parse(light_content), dark = parse(dark_content), syntax = parse(syntax_content); | ||
|
||
// let light = require('../jsonc/lightUI.jsonc'), dark = require('../jsonc/darkUI.jsonc'), syntax = require('../json/syntax.json'); | ||
|
||
let light, dark, syntax; | ||
fetch("../jsonc/lightUI.jsonc") | ||
.then((response) => response.json()) | ||
.then((data) => { | ||
console.log(data); | ||
}) | ||
.catch((error) => console.error("Error:", error)); | ||
import light from "../jsonc/lightUI.jsonc"; | ||
import dark from "../jsonc/darkUI.jsonc"; | ||
import syntax from "../jsonc/syntax.jsonc"; | ||
|
||
console.log("light========", light); | ||
|
||
let output = { | ||
"Eva-Light": {}, | ||
"Eva-Light-Italic": {}, | ||
"Eva-Light-Bold": {}, | ||
"Eva-Light-Italic-Bold": {}, | ||
"Eva-Dark": {}, | ||
"Eva-Dark-Italic": {}, | ||
"Eva-Dark-Bold": {}, | ||
"Eva-Dark-Italic-Bold": {}, | ||
}; | ||
|
||
for (let i in output) { | ||
if (i.indexOf("Light") > -1) { | ||
light.name = i.replace(/-/g, " "); | ||
output[i] = { | ||
...light, | ||
type: "light", | ||
tokenColors: scope2token("light", i), | ||
}; | ||
} else { | ||
dark.name = i.replace(/-/g, " "); | ||
output[i] = { | ||
...dark, | ||
type: "dark", | ||
tokenColors: scope2token("dark", i), | ||
}; | ||
} | ||
} | ||
|
||
console.log("output========", output); | ||
|
||
function scope2token(type, file) { | ||
let token = []; | ||
file = | ||
type == "light" | ||
? file.replace("-Light", "") | ||
: file.replace("-Dark", ""); | ||
for (let i in syntax) { | ||
let obj = { | ||
name: syntax[i].name, | ||
scope: i, | ||
settings: { | ||
foreground: syntax[i].foreground[type], | ||
fontStyle: syntax[i].fontStyle[file] || "", | ||
}, | ||
}; | ||
token.push(obj); | ||
} | ||
return token; | ||
} | ||
</script> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "js", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"jsonc-parser": "^3.3.1" | ||
} | ||
} |
Oops, something went wrong.