
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Termark is a basic library to format console output to the standard non-browser terminal.
dim, bold, italic, …)red, cyan, blueBright, …)ansi256())truecolor) colours (rgb())gradient())success(), info(), warn(), error())green`Success: File ${cyan`plans.txt`} created successfully!`)areColorsEnabled, is8bitEnabled, is24bitEnabled)npm install termark
Termark is compatible with both ECMAScript modules (import/export syntax), and CommonJS:
// CJS:
const termark = require('termark');
// ESM:
import termark from 'termark';
Termark offers both a default import that has access to all properties and methods, or you can import each one individually:
// Default import:
import termark from 'termark';
termark.info('This is the default import, where all properties and methods are accessible.');
// Named imports:
import { success, inverse } from 'termark';
success(
inverse('This text with a green background is achieved with named imports!')
)
Here's a quick reference for every feature Termark provides:
import termark from 'termark';
console.log(
termark.red('This is red text.'),
termark.bgGreen('This text has a green background.'),
termark.cyan`There's support for template strings as well`,
termark.ansi256('text', 33)('This single function handles text and background colour!'),
termark.rgb('background', 42, 122, 255)('This is some dark blue text'),
termark.gradient('text', [[53, 72, 172], [200, 230, 121]])('Gradients are also possible.'),
termark.areColorsEnabled,
termark.is8bitEnabled,
termark.is24bitEnabled
);
import termark from 'termark';
termark.reset('...');
termark.bold('...');
termark.dim('...');
termark.italic('...');
termark.underline('...');
termark.blink('...');
termark.inverse('...');
termark.overline('...');
termark.hidden('...');
termark.strike('...');
import termark from 'termark';
termark.black('...');
termark.red('...');
termark.green('...');
termark.yellow('...');
termark.blue('...');
termark.magenta('...');
termark.white('...');
termark.blackBright('...');
termark.redBright('...');
termark.greenBright('...');
termark.yellowBright('...');
termark.blueBright('...');
termark.magentaBright('...');
termark.whiteBright('...');
termark.bgBlack('...');
termark.bgRed('...');
termark.bgGreen('...');
termark.bgYellow('...');
termark.bgBlue('...');
termark.bgMagenta('...');
termark.bgWhite('...');
termark.bgBlackBright('...');
termark.bgRedBright('...');
termark.bgGreenBright('...');
termark.bgYellowBright('...');
termark.bgBlueBright('...');
termark.bgMagentaBright('...');
termark.bgWhiteBright('...');
import termark from 'termark';
termark.ansi256('text', 33)('...');
termark.ansi256('background', 200)('...');
import termark from 'termark';
// You can specify your RGB values as an array:
termark.rgb('text', [182, 22, 234])('...');
termark.rgb('background', [200, 0, 184])('...');
// ...or as a simple list of three values:
termark.rgb('text', 182, 22, 234)('...');
termark.rgb('background', 200, 0, 184)('...');
// This method is compatible with `color-convert`:
import convert from 'color-convert';
termark.rgb('text', convert.hex.rgb('008330'))('...');
Please note that gradients do not support nested styling.
import termark from 'termark';
termark.gradient('text', [[200, 123, 0], [0, 255, 255], [177, 209, 10]])('...');
termark.gradient('background', [[123, 75, 204], [255, 255, 255], [0, 44, 55]])('...');
import termark from 'termark';
termark.success('...'); // Logs some message in green as an info message.
termark.info('...'); // Logs some message in blue as an info message.
termark.warning('...'); // Logs some message in yellow as a warning.
termark.error('...'); // Logs some message in red as an error.
// These also support prefixes for branding purposes:
const brandPrefix = termark.blue('Example') + termark.blackBright(' - ');
termark.error('File not found', brandPrefix);
import termark from 'termark';
// Instead of using this:
termark.blue('...');
// ...you can use this:
termark.blue`...`;
import termark from 'termark';
termark.blue(
'This is some blue text ' +
termark.yellow('That becomes yellow,') +
' that becomes blue again.'
);
import termark from 'termark';
termark.areColorsEnabled; // Check whether terminal colours are enabled.
termark.is8bitEnabled; // Check whether 8-bit (256) colours are enabled.
termark.is24bitEnabled; // Check whether 24-bit (truecolor) colours are enabled.
You can use Termark by importing the object, or you can import the class:
import { Termark } from 'termark';
const termark = new Termark(); // This is the same as importing the `termark` object.
termark.success('Termark is working!');
// Alternatively, you could do this:
Termark.init.success('This work, too!');
Termark.init enables using the Termark class as the default termark object.
You can create custom themes (a collection of multiple styles) and loggers:
import termark, { Termark } from 'termark';
const myTheme = Termark.createTheme(
termark.blue, // <- Notice that we specify a built-in function *without calling it*!
termark.bold // Same goes for this one.
);
console.log(
myTheme('This text is bold and blue!')
);
// ------
// All properties but `default` are completely optional.
// If omitted, default ones are used
const myLogger = Termark.createLogger({
default: [
termark.cyan,
termark.italic
],
success: {
prefix: false, // Disable built-in prefix
styles: [
termark.greenBright,
termark.bold
]
},
info: {
prefix: 'Info' // Custom prefix to override the default
// No custom styles--use default ones.
},
// leave `warn` as-is
error: {
// Use default prefix; omitting or setting to an empty string have the same result.
styles: [
termark.bgRedBright,
termark.dim
]
},
});
myLogger.log('...'); // Uses the `default` property's options.
myLogger.success('...'); // Omitted prefix, uses custom styles.
myLogger.info('...'); // Uses custom prefix, default styles.
myLogger.warn('...'); // Left as-is.
myLogger.error('...'); // Uses default prefix, with custom styles.
Termark's code is licenced under the Apache licence version 2.
The full licence text is present in these source files.
In addition, this snippet of text is present at the top of all files:
Copyright 2025 Q
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
FAQs
A basic library to format console output to the standard non-browser terminal.
We found that termark 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.