mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-04-19 16:38:41 +00:00
子标签颜色
This commit is contained in:
parent
27f4884216
commit
a0947d6e0b
@ -24,7 +24,7 @@ class CCInspector {
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
private terminal = new Terminal('Inject', 'blue', 'gray');
|
||||
private terminal = new Terminal('Inject ', 'blue', 'gray');
|
||||
init() {
|
||||
console.log(...this.terminal.init());
|
||||
this.watchIsCocosGame();
|
||||
|
@ -3,6 +3,10 @@ export class Terminal {
|
||||
* 标签
|
||||
*/
|
||||
tag = 'terminal';
|
||||
/**
|
||||
* 子标签
|
||||
*/
|
||||
subTag = "";
|
||||
/**
|
||||
* 标签的颜色
|
||||
*/
|
||||
@ -22,33 +26,46 @@ export class Terminal {
|
||||
this.tag = tag;
|
||||
}
|
||||
init(): string[] {
|
||||
return this.log(`init`);
|
||||
this.txtColor = 'black';
|
||||
this.subTag = "init";
|
||||
return this.log(``);
|
||||
}
|
||||
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[] {
|
||||
this.txtColor = 'blue';
|
||||
this.subTag = "";
|
||||
return this.log(message);
|
||||
}
|
||||
public green(message: string): string[] {
|
||||
this.txtColor = 'green';
|
||||
this.subTag = "";
|
||||
return this.log(message);
|
||||
}
|
||||
public red(message: string): string[] {
|
||||
this.txtColor = 'red';
|
||||
this.subTag = "";
|
||||
return this.log(message);
|
||||
}
|
||||
message(msg: string): string[] {
|
||||
this.txtColor = 'black';
|
||||
return this.log(`[message] ${msg}`);
|
||||
this.subTag = 'message';
|
||||
return this.log(`${msg}`);
|
||||
}
|
||||
connect(msg: string): string[] {
|
||||
this.txtColor = 'black';
|
||||
return this.log(`[connect] ${msg}`);
|
||||
this.subTag = 'connect';
|
||||
return this.log(`${msg}`);
|
||||
}
|
||||
disconnect(msg: string): string[] {
|
||||
this.txtColor = 'black';
|
||||
return this.log(`[disconnect] ${msg}`);
|
||||
this.subTag = 'disconnect';
|
||||
return this.log(`${msg}`);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user