Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
acquerello
Advanced tools
Template based terminal coloring made really easy.
http://sw.cowtech.it/acquerello
Acquerello allows to add coloring to terminal in a really easy way.
To colorize a template using template syntax, simply use the colorize
function.
import { colorize } from 'acquerello'
console.log(colorize('{{red}}This is in red, {{green underline}}this in green underlined{{-}}, this in red again.'))
The template recognizes styles between double curly braces and the token {{-}}
as universal closing tag (which also restores the previous style).
Acquerello supports all colors codes recognized by ansi-style (and therefore by chalk).
The closing tag at the end of the string can be omitted, since acquerello will append the global reset style (\x1b[0m
) if any style was set.
If you want to discard the styles to be restored, use the {{reset}}
token.
If you want to define custom styles, use the addCustomStyle
function.
import { colorize, addCustomStyle } from 'acquerello'
addCustomStyle('important')
console.log(colorize('{{important}}This is in red, underlined.{{-}}'))
acquerello supports 256 ANSI codes and 16m RGB colors. Just give it a try:
import { colorize } from 'acquerello'
console.log(colorize('{{ansi:100}}color me{{-}}'))
console.log(colorize('{{bgANSI:3,4,5}}color me{{-}}'))
console.log(colorize('{{rgb:255,0,0}}color me{{-}}'))
console.log(colorize('{{bgRGB:0,255,0}}color me{{-}}'))
console.log(colorize('{{hex:#FF0000}}color me{{-}}'))
console.log(colorize('{{bgHEX:00FF00}}color me{{-}}'))
ANSI, RGB, and HEX can be used in style definitions and templates as well.
To colorize strings, simply use the applyStyle
, passing a list of styles you want to apply.
import { applyStyle } from 'acquerello'
const inRed = applyStyle('Colorized', 'red')
const inRedWithBlueBackground = applyStyle('Colorized', 'red bgBlue')
Copyright (C) 2019 and above Shogun (shogun@cowtech.it).
Licensed under the ISC license, which can be found at https://choosealicense.com/licenses/isc.
2021-01-02 / 0.1.3
FAQs
Template based terminal coloring made really easy.
The npm package acquerello receives a total of 50,717 weekly downloads. As such, acquerello popularity was classified as popular.
We found that acquerello demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.