代码拉取完成,页面将自动刷新
import { ANSIParams } from "./static.js"
// 颜色字符串的索引
export type IColorStr = keyof typeof ANSIParams.color
// 前(后)景色可以是 RGB 对象或颜色字符串
export type IColor = IRGB | IColorStr
// 文本样式
export type ITextStyle = keyof typeof ANSIParams.textStyle
// 光标的方向
export type IDirect = keyof typeof ANSIParams.cursor.direct
// 光标操作的索引
export type ICursor = keyof Omit<typeof ANSIParams.cursor, "direct">
export type IGlobalOpts = Partial<{
text: string; // 要打印的文本
reset: boolean; // 是否在末尾重置样式
type: string; // console的类型
split: boolean; // 是否拆分显示,在node中可以在一个console.log中分开显示,比如:console.log("1","2","3")和console.log("123"),前者在字符之间会有空格,split为true表示使用前者显示,反之使用后者,在浏览器环境下只能合并显示
color: IColor[] | IColor; // 前(后)景色或其数组,方便传入多个颜色参数,但是有些控制台似乎不兼容
textStyle: ITextStyle[] | ITextStyle; // 文本样式或样式数组
cursor: ICursor; // 光标控制
move: IMoveParams; // 光标移动参数
scroll: number; // 滚动条行数
style: Partial<CSSStyleDeclaration>; // CSS样式对象,仅支持浏览器环境
}>
export type IOpts = Omit<IGlobalOpts, "type" | "split">
// 颜色模式,2:真彩色模式; 5:兼容模式; null:默认颜色模式
export type IColorMode = keyof typeof ANSIParams.colorMode
// 颜色类型,48:背景颜色,38:字体颜色
export type IColorType = keyof typeof ANSIParams.colorType
export type IRGB = {
red?: string | number
green?: string | number
blue?: string | number
type?: IColorType // 字体颜色或背景颜色
mode?: IColorMode
color?: string | number// 兼容模式下,256色调色板的颜色索引
}
export type IPosition = {
col: number | string // 列
row: number | string // 行
}
export type IMoveParams = {
direct: IDirect// 移动方向
position: IPosition | number | string// 移动到的位置,可以是坐标对象或数字
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。