starlight-color
v1.0.5
Published
Starlight Programming Language with Color Support
Maintainers
Readme
Starlight Color Utilities
Package: starlight-color
Author: Dominex Macedon
Description
starlight-color is a tiny, dependency-free Node.js library to style terminal output in Starlight Programming Language (or any Node.js CLI).
It supports:
- Standard ANSI colors
- Bright colors
- Gray / dim variants
- Background colors
- 256-color foreground and background
- Text styles (bold, underline, italic, inverse, strikethrough, hidden)
It works in any Node.js CLI environment and is safe to use with any type of value (numbers, objects, strings, etc.).
Installation
npm install starlight-colorUsage
Importing the package
import * as color from "starlight-color";Basic Colors
console.log(color.colors.red("This text is red"));
console.log(color.colors.green("This text is green"));
console.log(color.colors.brightBlue("Bright blue text"));
console.log(color.colors.gray("Gray text"));Background Colors
console.log(color.bgColors.yellow("Yellow background"));
console.log(color.bgColors.brightCyan("Bright cyan background"));Text Styles
console.log(color.styles.bold("Bold text"));
console.log(color.styles.italic("Italic text"));
console.log(color.styles.underline("Underlined text"));
console.log(color.styles.strikethrough("Strikethrough text"));
console.log(color.styles.inverse("Inverse colors"));256-Color Support
console.log(color.colors.fg256(202, "Foreground 256-color"));
console.log(color.bgColors.bg256(21, "Background 256-color"));Combining Colors and Styles
Use the style() function to combine multiple effects:
console.log(color.style("Custom styled text", {
color: "cyan", // Foreground
bg: "magenta", // Background
bold: true,
underline: true
}));
console.log(color.style("256-color with bold", {
fg256: 208, // Foreground 256-color
bg256: 20, // Background 256-color
bold: true
}));Available Colors
Standard
black,red,green,yellow,blue,magenta,cyan,white,gray
Bright
brightRed,brightGreen,brightYellow,brightBlue,brightMagenta,brightCyan,brightWhite
Backgrounds
bgColorswith same names, plus bright versions and 256-color support (bg256(n, text))
Styles
bold,dim,italic,underline,inverse,hidden,strikethrough
Notes
- Works only in terminal/CLI environments (Node.js)
- ANSI color codes are used; will not style browsers or GUI applications
- Supports any JavaScript value, not just strings
Developer: Dominex Macedon
