Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nin-jin/felt-pen
Tiny ANSI terminal coloring library
https://github.com/nin-jin/felt-pen
Last synced: about 1 month ago
JSON representation
Tiny ANSI terminal coloring library
- Host: GitHub
- URL: https://github.com/nin-jin/felt-pen
- Owner: nin-jin
- License: mit
- Created: 2021-09-26T19:28:03.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-08-07T13:39:43.000Z (over 2 years ago)
- Last Synced: 2024-11-20T05:08:50.229Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 25.4 KB
- Stars: 15
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# felt-pen
Tiny ANSI terminal coloring library
![](https://i.imgur.com/Jm0yG3D.png)
## [Benchmarks](https://github.com/ai/nanocolors#benchmarks)
### Calling
```
chalk 1,192,251 ops/sec
cli-color 130,947 ops/sec
ansi-colors 683,415 ops/sec
kleur 1,352,980 ops/sec
kleur/colors 1,383,478 ops/sec
colorette 1,503,513 ops/sec
felt-pen 1,414,047 ops/sec
nanocolors 1,530,478 ops/sec
```### Loading
```
chalk 13.964 ms
cli-color 98.851 ms
ansi-colors 3.832 ms
kleur 7.182 ms
kleur/colors 1.469 ms
colorette 2.221 ms
felt-pen 1.424 ms
nanocolors 2.494 ms
```### Size
```
chalk 101 kB
cli-color 1249 kB
ansi-colors 25 kB
kleur 21 kB
colorette 16 kB
felt-pen 9 kB
nanocolors 16 kB
```## Install
```sh
yarn add felt-pen
```## Usage
```js
import * as pen from 'felt-pen'console.log( pen.blue( `Hello, ${pen.bold( 'World' )}!!!` ) )
```See the demo ([mjs](./demo.mjs), [cjs](./demo.mjs)) for all supported ansi attributes.
# Compatibility
## Github Actions
[GitHub have broken TTY](https://github.com/actions/runner/issues/241). As workaround, set default shell in your [workflow](https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#defaultsrun) or [job](https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_iddefaultsrun) or [run](https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepsrun) as in example:
```yaml
defaults:
run:
shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"'
```