Skip to content

Commit 745865d

Browse files
committed
Presets: convert hard coded ANSI escape code to formatting placeholders
1 parent 8bdca1b commit 745865d

File tree

6 files changed

+32
-27
lines changed

6 files changed

+32
-27
lines changed

presets/archey.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
},
4141
{
4242
"type": "terminal",
43-
"format": "{5} {6} \u001b[37m█\u001b[97m█ \u001b[36m█\u001b[96m█ \u001b[35m█\u001b[95m█ \u001b[34m█\u001b[94m█ \u001b[33m█\u001b[93m█ \u001b[32m█\u001b[92m█ \u001b[31m█\u001b[91m█ \u001b[30m█\u001b[90m"
43+
"format": "{5} {6} {#37}█{#97}█ {#36}█{#96}█ {#35}█{#95}█ {#34}█{#94}█ {#33}█{#93}█ {#32}█{#92}█ {#31}█{#91}█ {#30}█{#90}"
4444
},
4545
{
4646
"type": "packages",

presets/examples/10.jsonc

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,26 @@
1414
"modules": [
1515
{
1616
"type": "custom",
17-
"format": "\u001b[90m┌────────────────────────────────────────────────────────────┐"
17+
"format": "┌────────────────────────────────────────────────────────────┐",
18+
"outputColor": "90"
1819
},
1920
{
2021
"type": "title",
2122
"keyWidth": 10
2223
},
2324
{
2425
"type": "custom",
25-
"format": "\u001b[90m└────────────────────────────────────────────────────────────┘"
26+
"format": "└────────────────────────────────────────────────────────────┘",
27+
"outputColor": "90"
2628
},
2729
{
2830
"type": "custom",
29-
"format": " \u001b[90m\u001b[31m\u001b[32m\u001b[33m\u001b[34m\u001b[35m\u001b[36m\u001b[37m\u001b[38m\u001b[39m  \u001b[38m\u001b[37m\u001b[36m\u001b[35m\u001b[34m\u001b[33m\u001b[32m\u001b[31m\u001b[90m"
31+
"format": " {#90}{#31}{#32}{#33}{#34}{#35}{#36}{#37}{#38}{#39}  {#38}{#37}{#36}{#35}{#34}{#33}{#32}{#31}{#90}"
3032
},
3133
{
3234
"type": "custom",
33-
"format": "\u001b[90m┌────────────────────────────────────────────────────────────┐"
35+
"format": "┌────────────────────────────────────────────────────────────┐",
36+
"outputColor": "90"
3437
},
3538
{
3639
"type": "os",
@@ -139,12 +142,13 @@
139142
},
140143
{
141144
"type": "custom",
142-
"format": "\u001b[90m└────────────────────────────────────────────────────────────┘"
145+
"format": "└────────────────────────────────────────────────────────────┘",
146+
"outputColor": "90"
143147
},
144148
"break",
145149
{
146150
"type": "custom",
147-
"format": " \u001b[90m\u001b[31m\u001b[32m\u001b[33m\u001b[34m\u001b[35m\u001b[36m\u001b[37m\u001b[38m\u001b[39m  \u001b[38m\u001b[37m\u001b[36m\u001b[35m\u001b[34m\u001b[33m\u001b[32m\u001b[31m\u001b[90m"
151+
"format": " {#90}{#31}{#32}{#33}{#34}{#35}{#36}{#37}{#38}{#39}  {#38}{#37}{#36}{#35}{#34}{#33}{#32}{#31}{#90}"
148152
}
149153
]
150154
}

presets/examples/12.jsonc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"type": "none"
55
},
66
"display": {
7-
"separator": "-> "
7+
"separator": "\u001b[1m-> "
88
},
99
"modules": [
1010
{
@@ -14,7 +14,7 @@
1414
"break",
1515
{
1616
"type": "custom",
17-
"format": "┌───────────────────────────── \u001b[1mSystem Information\u001b[0m ─────────────────────────────┐" // `\u001b` is `\033`, or `\e`
17+
"format": "┌───────────────────────────── {#1}System Information{#} ─────────────────────────────┐"
1818
},
1919
"break",
2020
{
@@ -92,7 +92,7 @@
9292
"break",
9393
{
9494
"type": "custom",
95-
"format": "└──────────────────────────────────────────────────────────────────────────────┘" // `\u001b` is `\033`, or `\e`
95+
"format": "└──────────────────────────────────────────────────────────────────────────────┘"
9696
},
9797
"break",
9898
{

presets/examples/13.jsonc

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,54 +17,55 @@
1717
},
1818
{
1919
// draw borders first to make colors of left and right border consistant
20-
"key": "│ │\u001b[11D\u001b[31m user",
20+
"key": "│ │\u001b[11D{#31} user",
2121
"type": "title",
2222
"format": "{1}"
2323
},
2424
{
25-
"key": "│ │\u001b[11D\u001b[32m󰇅 hname",
25+
"key": "│ │\u001b[11D{#32}󰇅 hname",
2626
"type": "title",
2727
"format": "{2}"
2828
},
2929
{
30-
"key": "│ │\u001b[11D\u001b[33m󰅐 uptime",
30+
"key": "│ │\u001b[11D{#33}󰅐 uptime",
3131
"type": "uptime"
3232
},
3333
{
34-
"key": "│ │\u001b[11D\u001b[34m󰟾 distro",
34+
"key": "│ │\u001b[11D{#34}󰟾 distro",
3535
"type": "os"
3636
},
3737
{
38-
"key": "│ │\u001b[11D\u001b[35m kernel",
38+
"key": "│ │\u001b[11D{#35} kernel",
3939
"type": "kernel"
4040
},
4141
{
42-
"key": "│ │\u001b[11D\u001b[36m󰇄 desktop",
42+
"key": "│ │\u001b[11D{#36}󰇄 desktop",
4343
"type": "de"
4444
},
4545
{
46-
"key": "│ │\u001b[11D\u001b[31m term",
46+
"key": "│ │\u001b[11D{#31} term",
4747
"type": "terminal"
4848
},
4949
{
50-
"key": "│ │\u001b[11D\u001b[32m shell",
50+
"key": "│ │\u001b[11D{#32} shell",
5151
"type": "shell"
5252
},
5353
{
54-
"key": "│ │\u001b[11D\u001b[33m󰍛 cpu",
55-
"type": "cpu"
54+
"key": "│ │\u001b[11D{#33}󰍛 cpu",
55+
"type": "cpu",
56+
"showPeCoreCount": true
5657
},
5758
{
58-
"key": "│ │\u001b[11D\u001b[34m󰉉 disk",
59+
"key": "│ │\u001b[11D{#34}󰉉 disk",
5960
"type": "disk",
6061
"folders": "/"
6162
},
6263
{
63-
"key": "│ │\u001b[11D\u001b[35m memory",
64+
"key": "│ │\u001b[11D{#35} memory",
6465
"type": "memory"
6566
},
6667
{
67-
"key": "│ │\u001b[11D\u001b[36m󰩟 network",
68+
"key": "│ │\u001b[11D{#36}󰩟 network",
6869
"type": "localip",
6970
"format": "{1} ({4})"
7071
},
@@ -73,7 +74,7 @@
7374
"type": "custom"
7475
},
7576
{
76-
"key": "│ │\u001b[11D\u001b[m colors",
77+
"key": "│ │\u001b[11D{#39} colors",
7778
"type": "colors",
7879
"symbol": "circle"
7980
},

presets/examples/2.jsonc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"modules": [
1616
{
1717
"type": "custom", // HardwareStart
18-
"format": "┌─────────── \u001b[1mHardware Information\u001b[0m ───────────┐" // `\u001b` is `\033`, or `\e`
18+
"format": "┌─────────── {#1}Hardware Information{#} ───────────┐" // {#1} is the same as `\u001b[1m`. {#} is `\u001b[m`
1919
},
2020
{
2121
"type": "host",
@@ -71,7 +71,7 @@
7171
},
7272
{
7373
"type": "custom", // SoftwareStart
74-
"format": "├─────────── \u001b[1mSoftware Information\u001b[0m ───────────┤"
74+
"format": "├─────────── {#1}Software Information{#} ───────────┤"
7575
},
7676
{
7777
"type": "title",

presets/examples/8.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
{
4747
"type": "custom",
4848
"key": "",
49-
"format": "\u001b[31m███\u001b[32m███\u001b[33m███\u001b[34m███\u001b[35m███\u001b[36m███"
49+
"format": "{#31}███{#32}███{#33}███{#34}███{#35}███{#36}███"
5050
}
5151
]
5252
}

0 commit comments

Comments
 (0)