termpal
v1.2.2
Published
Shape your terminal theme in real time
Maintainers
Readme
Termpal
Shape your terminal theme in real time
Highlights
- Elegant built-in themes
- Semantic color keys (
red,blue,green, etc.) - RGB or hex color input
- Safe environment detection (TTY / CI /
NO_COLOR)
CLI
Install globally
npm i -g termpalOpen interactive picker (applies theme to the current terminal session only):
termpalPersistence
Install auto-apply into your shell profile:
termpal installRemove auto-apply from your shell profile:
termpal uninstallAPI
Install
npm i termpalUse built-in themes
import { termpal } from 'termpal'
termpal.use('Catppuccin')Supported themes
CatppuccinDraculaTokyoNightNordOneDarkGruvboxSolarizedDarkMonokaiProMonokaiDimmedGitHubDarkAyuDarkKanagawa
Set colors manually
import { termpal } from 'termpal'
termpal.set({
red: '#f38ba8',
green: '#a6e3a1',
yellow: [255, 200, 0],
})Supported keys
blackredgreenyellowbluemagentacyanwhitegrayredBrightgreenBrightyellowBrightblueBrightmagentaBrightcyanBrightwhiteBright
Reset palette
import { termpal } from 'termpal'
termpal.reset()Environment Detection
The library automatically disables itself when the terminal environment is unsuitable.
It will not send OSC sequences if:
- output is not a TTY
- running in CI
- the
NO_COLORenvironment variable is set
How It Works
The library sends the OSC 4 escape sequence:
ESC ] 4 ; index ; color BELExample:
ESC ] 4 ; 1 ; #f38ba8 BELThis instructs the terminal to change palette slot 1 (red).
Terminal Support
OSC palette modification is supported by many modern terminals including:
- iTerm2
- kitty
- WezTerm
- xterm
- Windows Terminal
Support may vary across terminals.
License
MIT
