参考资料:
使用 %c 为打印内容定义样式
// 指令前的文本不会受到影响,但指令后的文本将会使用参数中声明的 CSS 样式。
console.log("This is a %c message", "color: #f00; font-size: 18px;");
%c 语法可用的属性如下
- background 与其全写版本。
- border 与其全写版本。
- border-radius
- box-decoration-break
- box-shadow
- clear 和 float
- color
- cursor
- display
- font 与其全写版本。
- line-height
- margin
- outline 与其全写版本。
- padding
- text-transform 这类 text-* 属性
- white-space
- word-spacing 和 word-break
- writing-mode