Skip to content
This repository was archived by the owner on Nov 13, 2024. It is now read-only.

Commit 452197f

Browse files
committed
新增 前端终端颜色渲染
1 parent 9c27495 commit 452197f

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/app/service/terminal_color.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ export function encodeConsoleColor(text) {
3939
term.TERM_TEXT_B = "\x1B[1m";
4040

4141
// 基本颜色
42-
text = text.replace(/([A-Za-z _§&;\-\\.]{1,}:)/gim, "§6$1§r");
43-
text = text.replace(/INFO/gm, term.TERM_TEXT_GREEN + "INFO" + term.TERM_NULL);
44-
text = text.replace(/(\d{2,}:\d{2,}:\d{2,})/gm, term.TERM_TEXT_CYAN + "$1" + term.TERM_NULL);
42+
text = text.replace(/\[([^[\]]+)\]/gim, "[§1$1§r]");
43+
text = text.replace(/([A-Za-z0-9 _§&;\-\\.]{1,}: )/gim, "§6$1§r");
44+
// text = text.replace(/INFO/gm, term.TERM_TEXT_GREEN + "INFO" + term.TERM_NULL);
45+
// text = text.replace(/(\d{2,}:\d{2,}:\d{2,})/gm, term.TERM_TEXT_CYAN + "$1" + term.TERM_NULL);
4546

4647
// Minecraft 原生颜色替代解析
4748
text = text.replace(/§0/gm, term.TERM_TEXT_WHITE);
@@ -119,14 +120,22 @@ export function encodeConsoleColor(text) {
119120
"\\)",
120121
"\\{",
121122
"\\}",
123+
'\\"',
122124
"<",
123125
">",
124126
"Preparing start region for level"
125127
],
126128
//红色
127129
["WARN", "EULA", "Error", "Invalid", "Stopping the server", "Caused by", "Stopping"],
128130
//黄色
129-
["Starting Minecraft server on", "world_the_end", "world_nether", "Done", "MCSMANAGER"]
131+
[
132+
"Starting Minecraft server on",
133+
"world_the_end",
134+
"world_nether",
135+
"Done",
136+
"MCSMANAGER",
137+
"Server thread"
138+
]
130139
];
131140
for (var k in RegExpStringArr) {
132141
for (var y in RegExpStringArr[k]) {

src/app/views/Terminal.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,7 @@ export default {
793793
});
794794
this.pingConfigForm.is = false;
795795
this.eventConfigPanel.visible = false;
796+
this.terminalSettingPanel.visible = false;
796797
} catch (error) {
797798
this.$message({
798799
type: "error",

0 commit comments

Comments
 (0)