mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-04-20 00:48:43 +00:00
子标签颜色
This commit is contained in:
parent
27f4884216
commit
a0947d6e0b
@ -24,7 +24,7 @@ class CCInspector {
|
|||||||
}
|
}
|
||||||
}, 300);
|
}, 300);
|
||||||
}
|
}
|
||||||
private terminal = new Terminal('Inject', 'blue', 'gray');
|
private terminal = new Terminal('Inject ', 'blue', 'gray');
|
||||||
init() {
|
init() {
|
||||||
console.log(...this.terminal.init());
|
console.log(...this.terminal.init());
|
||||||
this.watchIsCocosGame();
|
this.watchIsCocosGame();
|
||||||
|
@ -3,6 +3,10 @@ export class Terminal {
|
|||||||
* 标签
|
* 标签
|
||||||
*/
|
*/
|
||||||
tag = 'terminal';
|
tag = 'terminal';
|
||||||
|
/**
|
||||||
|
* 子标签
|
||||||
|
*/
|
||||||
|
subTag = "";
|
||||||
/**
|
/**
|
||||||
* 标签的颜色
|
* 标签的颜色
|
||||||
*/
|
*/
|
||||||
@ -22,33 +26,46 @@ export class Terminal {
|
|||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
}
|
}
|
||||||
init(): string[] {
|
init(): string[] {
|
||||||
return this.log(`init`);
|
this.txtColor = 'black';
|
||||||
|
this.subTag = "init";
|
||||||
|
return this.log(``);
|
||||||
}
|
}
|
||||||
public log(message: string, newline: boolean = false): string[] {
|
public log(message: string, newline: boolean = false): string[] {
|
||||||
return [`%c${this.tag}%c${newline ? '\n' : ''}${message}`, `color:${this.tagColor};background:${this.tagBackground};padding:0 4px`, `color:${this.txtColor};margin-left:5px`];
|
return [
|
||||||
|
`*%c${this.tag}%c${this.subTag}%c${newline ? '\n' : ''}${message}`,
|
||||||
|
`color:${this.tagColor};background:${this.tagBackground};padding:0 4px`,
|
||||||
|
`color:white;background:black;padding:0 3px`,
|
||||||
|
`color:${this.txtColor};background:#e6e6e6;margin-left:5px`
|
||||||
|
];
|
||||||
}
|
}
|
||||||
public blue(message: string): string[] {
|
public blue(message: string): string[] {
|
||||||
this.txtColor = 'blue';
|
this.txtColor = 'blue';
|
||||||
|
this.subTag = "";
|
||||||
return this.log(message);
|
return this.log(message);
|
||||||
}
|
}
|
||||||
public green(message: string): string[] {
|
public green(message: string): string[] {
|
||||||
this.txtColor = 'green';
|
this.txtColor = 'green';
|
||||||
|
this.subTag = "";
|
||||||
return this.log(message);
|
return this.log(message);
|
||||||
}
|
}
|
||||||
public red(message: string): string[] {
|
public red(message: string): string[] {
|
||||||
this.txtColor = 'red';
|
this.txtColor = 'red';
|
||||||
|
this.subTag = "";
|
||||||
return this.log(message);
|
return this.log(message);
|
||||||
}
|
}
|
||||||
message(msg: string): string[] {
|
message(msg: string): string[] {
|
||||||
this.txtColor = 'black';
|
this.txtColor = 'black';
|
||||||
return this.log(`[message] ${msg}`);
|
this.subTag = 'message';
|
||||||
|
return this.log(`${msg}`);
|
||||||
}
|
}
|
||||||
connect(msg: string): string[] {
|
connect(msg: string): string[] {
|
||||||
this.txtColor = 'black';
|
this.txtColor = 'black';
|
||||||
return this.log(`[connect] ${msg}`);
|
this.subTag = 'connect';
|
||||||
|
return this.log(`${msg}`);
|
||||||
}
|
}
|
||||||
disconnect(msg: string): string[] {
|
disconnect(msg: string): string[] {
|
||||||
this.txtColor = 'black';
|
this.txtColor = 'black';
|
||||||
return this.log(`[disconnect] ${msg}`);
|
this.subTag = 'disconnect';
|
||||||
|
return this.log(`${msg}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user