Functions that surround a string with ansistyle codes.
Installations
npm install ansistyles
Developer Guide
Typescript
No
Module System
CommonJS
NPM Version
1.3.11
Score
100
Supply Chain
86.8
Quality
75.1
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
thlorenz
Download Statistics
Total Downloads
152,388,972
Last Day
42,841
Last Week
200,571
Last Month
928,689
Last Year
14,990,762
GitHub Statistics
10 Stars
16 Commits
1 Forks
4 Watching
1 Branches
1 Contributors
Bundle Size
377.00 B
Minified
278.00 B
Minified + Gzipped
Package Meta Information
Latest Version
0.1.3
Package Id
ansistyles@0.1.3
Size
2.57 kB
NPM Version
1.3.11
Publised On
03 Dec 2013
Total Downloads
Cumulative downloads
Total Downloads
152,388,972
Last day
-6.5%
42,841
Compared to previous day
Last week
-16.1%
200,571
Compared to previous week
Last month
0.2%
928,689
Compared to previous month
Last year
-34.8%
14,990,762
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
No dependencies detected.
ansistyles
Functions that surround a string with ansistyle codes so it prints in style.
Installation
npm install ansistyles
Usage
1var styles = require('ansistyles'); 2 3console.log(styles.bright('hello world')); // prints hello world in 'bright' white 4console.log(styles.underline('hello world')); // prints hello world underlined 5console.log(styles.inverse('hello world')); // prints hello world black on white
Combining with ansicolors
Get the ansicolors module:
npm install ansicolors
1var styles = require('ansistyles') 2 , colors = require('ansicolors'); 3 4 console.log( 5 // prints hello world underlined in blue on a green background 6 colors.bgGreen(colors.blue(styles.underline('hello world'))) 7 );
Tests
Look at the tests to see more examples and/or run them via:
npm explore ansistyles && npm test
More Styles
As you can see from here, more styles are available, but didn't have any effect on the terminals that I tested on Mac Lion and Ubuntu Linux.
I included them for completeness, but didn't show them in the examples because they seem to have no effect.
Alternatives
ansistyles tries to meet simple use cases with a very simple API. However, if you need a more powerful ansi formatting tool, I'd suggest to look at the features of the ansi module.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 existing vulnerabilities detected
Reason
Found 0/16 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
3
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More