Skip to content

Commit 0cf77e4

Browse files
committed
update to version 0.0.5
1. use 'comment-json' to parse the Windows Terminal config file 2. use prettier and eslint to format code
1 parent c1a6506 commit 0cf77e4

11 files changed

+941
-127
lines changed

.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = unset
7+
charset = utf-8
8+
trim_trailing_whitespace = false
9+
insert_final_newline = false

.eslintrc.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"env": {
3+
"commonjs": true,
4+
"es6": true,
5+
"node": true
6+
},
7+
"extends": "eslint:recommended",
8+
"globals": {
9+
"Atomics": "readonly",
10+
"SharedArrayBuffer": "readonly"
11+
},
12+
"parserOptions": {
13+
"ecmaVersion": 2018
14+
},
15+
"rules": {
16+
"no-constant-condition": "off"
17+
}
18+
}

.prettierrc

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"printWidth": 100,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": true,
7+
"jsxSingleQuote": false,
8+
"trailingComma": "none",
9+
"bracketSpacing": true,
10+
"jsxBracketSameLine": false,
11+
"arrowParens": "avoid"
12+
}

README.md

+27
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# wtcolor
22

3+
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat)](https://github.com/prettier/prettier) ![GitHub](https://img.shields.io/github/license/Crawler995/wtcolor?style=flat)[![codebeat badge](https://codebeat.co/badges/d5f78ecf-3239-460a-9855-852ca6faba38)](https://codebeat.co/projects/github-com-crawler995-wtcolor-master)
4+
35
A tool that can change color theme of Windows Terminal conveniently and easily!
46

57
The default Windows Terminal is nothing like the one on the official video...How can we change its color theme easily? Use `wtcolor`.
@@ -20,3 +22,28 @@ npm install -g wtcolor
2022
# Use 'wtcolor' in Windows Terminal
2123
wtcolor
2224
```
25+
26+
## Key Point
27+
28+
1. The path of configuration file
29+
30+
I found [the official documation](https://github.com/microsoft/terminal/blob/2d707f102bf27d455e15dcc6001337a8da6869c2/doc/user-docs/UsingJsonSettings.md) about this:
31+
32+
> The settings are stored in the file `$env:LocalAppData\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\profiles.json`
33+
34+
So I'm assuming that the configuration file path is the same as above no matter where you downloaded and installed it. **If not**, `wtcolor` gives you the chance to input the path manually. If the given path is correct, it will be saved locally and you don't have to input it again.
35+
36+
2. Parsing the configuration file
37+
38+
The configuration file is `JSON with Comment` which isn't the standard `JSON` format and can't be parsed with `JSON.parse()`. Before `version 0.0.4`, I just removed the line comments simply and parsed it, which may caused bugs. In `version 0.0.5`, I changed to use `comment-json` which has the same interface as `JSON` and can parse `JSON with Comment` to parse the file.
39+
40+
3. Network error sometimes
41+
42+
Just try it more times.
43+
44+
The color theme comes from `Github`, so if you are in China the request may be blocked or slowed down by something. As you can see, the requests in my demo is also slowly.
45+
46+
## Thanks
47+
48+
All guys have used `wtcolor`! Hope for your feedback.
49+

0 commit comments

Comments
 (0)