
Product
Socket Now Protects the Chrome Extension Ecosystem
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
ansi-construct
Advanced tools
[](https://www.npmjs.com/package/ansi-construct)
Construct ANSI colors strings from object descriptors.
import { ansi } from 'ansi-construct'
const item = ansi({ text: 'foo', color: ['red', 'bold'], padStart: 5 })
// change it after creation
item.padStart = 6
// stringify
console.log(`${item}`) // ' foo'
import { ansi } from 'ansi-construct'
const items = [
ansi({ text: 'foo', color: ['red', 'bold'], padStart: 5 }),
ansi({ text: 'bar', color: 'underline' }),
ansi('baz', 'blue'),
]
// stringify
console.log(items.join('')) // ' foo\n\u001b[4mbar\u001b[0mbaz\u001b[0m'
import type { AnsiItem } from 'ansi-construct'
import { construct } from 'ansi-construct'
const items: AnsiItem[] = [
{ text: 'foo', color: 'red', padStart: 5 },
{ text: 'bar', color: ['green', 'bold', 'underline'] },
' raw text ',
{ t: 'shorthand', c: 'cyan' }
]
console.log(construct(items)) // '\x1b[31mfoo\x1b[0m \x1b[32mbar\x1b[0m raw text \x1b[36m\x1b[0m'
MIT License © 2022 Anthony Fu
FAQs
[](https://www.npmjs.com/package/ansi-construct)
The npm package ansi-construct receives a total of 0 weekly downloads. As such, ansi-construct popularity was classified as not popular.
We found that ansi-construct demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
Product
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.