termlux
v1.1.0
Published
A terminal UI styling system — design tokens, components, smart logs, and animations for modern CLIs
Maintainers
Readme
Termlux
A terminal UI styling system for modern JavaScript.
Termlux is not another color library. Chalk, Picocolors, Colorette, and Kleur already solve terminal coloring well. Termlux goes further — it gives you design tokens, styled components, smart structured logs, DevOps resource reporters, big text rendering, character fill effects, and animations in one zero-dependency package.
npm install termluxFeatures
- Fluent styling — chain colors, typography, padding, and borders like Tailwind for the terminal
- Design tokens — semantic themes with hex colors (
success,danger,warning, …) - Components —
success(),error(),warning(),card()with icons and layout - Smart logger — timestamps, icons, alignment, and nested task groups
- DevOps logger — jobs, replicas, GPUs, pods with status reporting
- Big text — block-letter ASCII banners with solid and colored output
- Character fill — pattern-filled regions and text art with readable contrast
- Animations — rainbow text, typewriter effect, gradient spinners
- Zero dependencies — pure ANSI, works in Node 18+
- Full TypeScript — shipped
.d.tstypes included - ESM native — modern
importsyntax out of the box
Quick Start
import { term, log, success, logger } from 'termlux';
// Fluent terminal styling
console.log(
term('Deploy Complete')
.green()
.bold()
.bgBlack()
.rounded()
.padding(1)
.render()
);
// ╭─────────────────────╮
// │ Deploy Complete │
// ╰─────────────────────╯
// Smart structured logs
log.info('Starting');
log.step('Allocating GPU');
log.success('GPU Allocated');
// DevOps status
logger.job('job-123').running();
logger.gpu('GPU-0').allocated();
// Components
console.log(success('Model deployed'));API Reference
Fluent Styling — term()
Chain styles like a terminal CSS framework:
import { term } from 'termlux';
term('Hello')
.color('#3b82f6') // hex or named color
.bold()
.italic()
.underline()
.bgBlack()
.padding(2)
.rounded() // rounded | square | double | heavy
.render();
term('Alert').red().bgYellow().border('heavy').render();Color methods: .black() .red() .green() .yellow() .blue() .magenta() .cyan() .white() .gray()
Background methods: .bgBlack() .bgRed() .bgGreen() .bgYellow() .bgBlue() .bgMagenta() .bgCyan() .bgWhite() .bgGray() .bg(color)
Typography: .bold() .dim() .italic() .underline() .inverse() .strikethrough()
Layout: .padding(n) .rounded(style?) .border(style?) .minWidth(n)
Design Tokens — createTheme()
Define a theme once, use semantic names everywhere:
import { createTheme } from 'termlux';
const theme = createTheme({
success: '#22c55e',
danger: '#ef4444',
warning: '#f59e0b',
primary: '#3b82f6',
});
theme.success('Job completed'); // green text
theme.danger('Job failed'); // red text
theme.warning('Degraded'); // amber text
theme.primary('Processing...'); // blue text
// Extend an existing theme
const dark = theme.extend({ muted: '#6b7280' });A default theme is exported as defaultTheme.
Components
Pre-built styled messages and cards:
import { success, error, warning, info, card } from 'termlux';
success('Model deployed'); // ✓ Model deployed
error('GPU unavailable'); // ✗ GPU unavailable
warning('Replica restarting'); // ⚠ Replica restarting
info('Checking health'); // ℹ Checking health
card({
title: 'Inference Job',
status: 'Running',
replicas: 3,
});
// ┌ Inference Job ──────────┐
// │ Status : Running │
// │ Replicas : 3 │
// └─────────────────────────┘
card({
title: 'Cluster',
fields: { Nodes: 4, GPUs: 8, Jobs: 12 },
border: 'rounded',
theme: myTheme,
});Smart Log Visualizer — log
Structured logs with automatic timestamps, colors, icons, and alignment:
import { log, createLog } from 'termlux';
log.info('Starting');
log.step('Allocating GPU');
log.success('GPU Allocated');
log.error('Replica Failed');
log.warn('High memory usage');
// 09:22:10 ℹ Starting
// 09:22:11 → Allocating GPU
// 09:22:13 ✓ GPU Allocated
// 09:22:20 ✗ Replica FailedNested tasks:
const task = log.task('Deploy Model');
task.step('Pull Image');
task.step('Allocate GPU');
task.success();
// ▶ Deploy Model
// → Pull Image
// → Allocate GPU
// ✓ Deploy ModelCustom logger:
const silent = createLog({ write: false, timestamps: false });
const line = silent.success('Captured output');
// use `line` string without writing to stdoutDevOps Logger — logger
Purpose-built for Kubernetes, inference jobs, and infrastructure CLIs:
import { logger, createDevopsLogger } from 'termlux';
logger.job('job-123').running();
logger.replica('replica-2').failed();
logger.gpu('GPU-0').allocated();
logger.pod('pod-abc').pending();
logger.node('node-1').succeeded();
logger.service('inference-api').scaling();
// 🚀 job-123 RUNNING
// 🔁 replica-2 FAILED
// 🎮 GPU-0 ALLOCATEDAvailable statuses: .running() .pending() .failed() .succeeded() .allocated() .released() .scaling() .terminated()
Animations — ui
Terminal motion effects:
import { ui, rainbow, typewriter, spinner } from 'termlux';
// Rainbow gradient text
console.log(ui.rainbow('Deployment Complete'));
// Typewriter effect
await ui.typewriter('Deploying inference model...', { delay: 40 });
// Spinner with gradient color
const spin = ui.spinner({
text: 'Allocating GPU',
color: 'gradient', // or any color / hex
});
await new Promise(r => setTimeout(r, 2000));
spin.stop('✓ GPU Allocated');Big text and fill utilities are also available on the ui namespace — see below.
Big Text — bigText()
Render large text for CLI headers, splash screens, and deployment output. Two styles are available:
Block letters (multi-line ASCII art):
import { bigText, bigTextSolid, ui } from 'termlux';
console.log(bigText('HELLO'));
console.log(bigText('DEPLOY', { color: '#3b82f6', bold: true }));
// Solid block characters (█) for clearer readability
console.log(bigTextSolid('TERMLUX', { color: '#22c55e' }));
console.log(ui.bigText('OK', { solid: true, color: 'cyan' }));Pure text (single-line Unicode letters — readable like normal text, just bigger):
import { bigTextPure, toPureText, ui } from 'termlux';
console.log(bigTextPure('Termlux')); // 𝗧𝗲𝗿𝗺𝗹𝘂𝘅
console.log(bigText('Hello', { font: 'pure', color: 'cyan' }));
console.log(toPureText('Deploy 2026')); // transform only, no styling
console.log(ui.bigTextPure('Ready', { color: '#22c55e' }));Define a custom font with plain text glyph rows:
import { defineFont, bigText } from 'termlux';
defineFont('minimal', {
H: ['# #', '#####', '# #'],
I: [' ### ', ' # ', ' ### '],
});
console.log(bigText('HI', { font: 'minimal' }));
// Or pass an inline font object
bigText('Z', {
font: {
Z: ['ZZZ', ' Z ', ' Z '],
},
});Options: font color bold solid char spacing bg padding
font: 'block'— default multi-line ASCII art (default)font: 'pure'— single-line Unicode bold letters viabigTextPure()font: 'myFont'— use a font registered withdefineFont()solid: true— uses thick█blocks instead of#strokes (block font only)bigTextSolid()— preset withsolid: trueandbold: truebg— optional background panel; omit for transparent output
Block font supports A–Z, 0–9, and common symbols (!, ?, ., -, _). Pure text supports A–Z, a–z, and 0–9; other characters are kept as-is.
Character Fill — fill()
Fill rectangular regions or text art interiors with repeating character patterns:
import { fill, fillBox, fillText, fillTextSolid, bigText, ui } from 'termlux';
// Fill a box with a character pattern
console.log(fillBox(40, 3, { chars: '·', color: 'gray' }));
// Overlay big text on a fill pattern
console.log(
fillBox(42, 5, {
chars: '·',
color: 'gray',
text: bigText('GO', { solid: true }),
textColor: '#22c55e',
}),
);
// Fill empty spaces inside text art
console.log(
fillText(bigText('OK'), {
solid: true,
inkColor: 'cyan',
fillColor: 'gray',
chars: '·',
}),
);
// Readable preset — solid letters + subtle fill
console.log(fillTextSolid(bigText('OK'), { inkColor: 'cyan' }));
// Shorthand router
fill(40, 3, { chars: '·' }); // box mode (width, height)
fill(bigText('A'), { chars: '·' }); // text modefillBox options: chars color text textColor textBold textSolid align bg
fillText options: chars inkColor fillColor solid bold color bg padding
Use inkColor for letter strokes and fillColor for the interior pattern so text stays readable. Prefer subtle fill characters like · rather than # when overlaying text.
Low-level Utilities
For advanced use cases:
import {
wrap,
resolveFg,
resolveBg,
drawBox,
drawCard,
stripAnsi,
visibleLength,
RAINBOW,
} from 'termlux';
// Manual ANSI wrapping
wrap('text', [resolveFg('#22c55e')]);
// Draw boxes directly
drawBox(['Line 1', 'Line 2'], { style: 'rounded', padding: 1 });
// Measure visible string length (strips ANSI)
visibleLength(coloredString);TypeScript
Full type definitions are included. No @types/ package needed.
import {
term,
bigText,
createTheme,
Log,
DevopsLogger,
CardOptions,
BigTextOptions,
FillTextOptions,
} from 'termlux';
const theme = createTheme({ primary: '#3b82f6' });
const message: string = theme.primary('Hello');
const banner: string = bigText('Deploy', { solid: true, color: '#3b82f6' });
const customLog = new Log({ timestamps: true, indent: 0 });Run type checking:
npm run typecheckModule Formats
| Format | Support |
|--------|---------|
| ESM (import) | ✅ Native |
| TypeScript types | ✅ Included |
| Node.js | ✅ 18+ |
| Bun / Deno | ✅ Compatible |
// ESM
import { term, log } from 'termlux';
// Dynamic import
const { term } = await import('termlux');Examples
Run the full demo:
npm run demoWhy Termlux?
| Library | Colors | Themes | Components | Logs | DevOps | Big Text | Animation | |---------|--------|--------|------------|------|--------|----------|-----------| | Chalk | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | | Picocolors | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | | Ink | ✅ | ❌ | ✅ (React) | ❌ | ❌ | ❌ | ❌ | | Termlux | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Termlux fills the gap between "color a string" and "build a full TUI framework." It is ideal for:
- Deployment CLIs
- Inference / ML job runners
- Kubernetes operators
- CI/CD pipeline output
- Developer tooling
License
Termlux is open source under the BSD 3-Clause License. You are free to use, modify, and distribute it — including in commercial projects.
Attribution is required. If you use Termlux, you must mention it. Include the copyright notice and license text in your source distributions, and add a credit in your project docs, README, or CLI --about output.
Example attribution:
This project uses Termlux — https://github.com/agayen/termlux
Copyright (c) 2026, Termlux AuthorsSee LICENSE for the full license text.
