0.0.6 • Published 2 years ago

@mijizhe/ansi-escape-sequences v0.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

🌈

一个适用于Node.js的ANSI转义序列库。

an ANSI escape sequences library for Node.js.

Features

  • only esm is supported.

Install

pnpm install @mijizhe/ansi-escape-sequences

Useage

import {
  bgYellow,
  cyan,
  dim,
  magenta,
} from "@mijizhe/ansi-escape-sequences/colors"
import { newTerminal } from "@mijizhe/ansi-escape-sequences/terminal"
import { bold } from "@mijizhe/ansi-escape-sequences/text"
import { setTimeout as sleep } from "timers/promises"

const terminal = newTerminal()

await terminal
  .clearScreen()
  .cursorSavePosition()
  .cursorHide()
  .write()

for (let i = 30; i > 0; i--) {
  await terminal
    .cursorRestorePosition()
    .eraseDown()
    .text(bgYellow("loading…"))
    .linefeed(2)
    .text(dim(bold("{")), cyan(String(i)), dim(bold("}")))
    .write()
  await sleep(100)
}

await terminal
  .clearScreen()
  .text(cyan("hello"), magenta("world"), dim("!"))
  .linefeed()
  .cursorShow()
  .write()
  .write()
0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago