npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@color-pen/static

v1.0.1

Published

一点点 🤏 color-pen 的静态数据

Downloads

39

Readme

一点点 🤏 color-pen 的静态数据值

color-pen 的相关的静态数据,不常更新,且移出单独成包无依赖,共用性更强。

安装

npm install --save @color-pen/static

ANSI 模块相关

  • esc ANSI 转义符
  • csi CSI(Control Sequence Introducer)带 [esc 字符串 \u001b[ 或者是 \x1b
  • terminalResetStyle 重置属性样式,即 \x1b[0m
  • terminalRegExp 一个用于创建 ANSI 的正则字符串的函数,可用与判断字符串是否包含 ANSI 转义或是清理

esc

esc 表示 ANSI 的控制序列前缀描述,即 \x1b 或者是 \u001b

import { esc } from 'color-pen';
// 光标向上
const cursorMoveUpStr = esc.concat('[2A');

console.log(cursorMoveUpStr);

csi

csi 表示 ANSI 的控制序列,即 \x1b[ 或者是 \u001b[

import { csi } from 'color-pen';
// 光标向上
const cursorMoveUpStr = csi.concat('2A');

console.log(cursorMoveUpStr);

terminalResetStyle

terminalRestStyle 表示 ANSI 的属性重置,即 \x1b[0m\u001b[0m\x1b[m\u001b[m

import { pen, terminalResetStyle } from 'color-pen';

pen.red`我是红色的文本${terminalResetStyle.concat('其实,在使用 terminalResetStyle 的时候会被截断,而最后的返回,这里也是红的')}我也是红色的`;

terminalRegExp 正则

生成一段长的 ANSI 正则字符串,用于判断字符串是否包含 ANSI 转义或是清理字符串中的 ANSI 转义码。

import { terminalRegExp } from 'color-pen';

const tempRegExp = terminalRegExp();

tempRegExp.latestIndex = 0;

console.log(tempRegExp.test('\x1b[0m')); // true

tempRegExp.latestIndex = 0;

console.log(tempRegExp.test('\x1b[?25l')); // true

tempRegExp.latestIndex = 0;

console.log(tempRegExp.test('\x1b[38;5;236m')); // true

文档地址

@color-pen/static