npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@boba-cli/chapstick

v0.1.0-alpha.3

Published

TypeScript port of Lip Gloss terminal styling DSL

Readme

@boba-cli/chapstick

TypeScript port of Charmbracelet Lip Gloss for styling terminal strings. Implements a fluent Style API with colors, padding/margin, borders, alignment, joins/placement, and ANSI-aware rendering.

Install

pnpm add @boba-cli/chapstick

Quickstart

import { Style, borderStyles } from '@boba-cli/chapstick'

const card = new Style()
  .padding(1)
  .border(borderStyles.rounded)
  .borderForeground('#7c3aed')
  .alignHorizontal('center')
  .render('Hello Boba')

console.log(card)

Features

Style Builder

The Style class provides a fluent, immutable API for building terminal styles:

import { Style } from '@boba-cli/chapstick'

const style = new Style()
  .foreground('#ff0000') // Text color (hex, named, or rgb())
  .background('#000000') // Background color
  .bold() // Bold text
  .italic() // Italic text
  .underline() // Underlined text
  .strikethrough() // Strikethrough text
  .padding(1) // Padding on all sides
  .padding(1, 2) // Vertical, horizontal padding
  .padding(1, 2, 1, 2) // Top, right, bottom, left
  .margin(1) // Margin (same overloads as padding)
  .width(40) // Fixed width (truncates)
  .maxWidth(80) // Max width (wraps)
  .height(10) // Fixed height
  .maxHeight(20) // Max height
  .alignHorizontal('center') // left | center | right
  .alignVertical('center') // top | center | bottom
  .border(true) // Enable default border
  .border(borderStyles.rounded) // Use specific border style
  .borderForeground('#7c3aed') // Border color
  .inline() // Strip newlines, skip padding/margin
  .render('Your text here')

Style Inheritance

Styles can inherit properties from other styles (excluding padding and margin):

const base = new Style().bold().foreground('#00ff00')
const derived = new Style().italic().inherit(base)
// derived has: bold, italic, foreground

Adaptive Colors

Support for light/dark terminal backgrounds:

const style = new Style().foreground({
  light: '#000000', // Used on light backgrounds
  dark: '#ffffff', // Used on dark backgrounds
})

Composition

import { Style, joinHorizontal, joinVertical, place } from '@boba-cli/chapstick'

const label = new Style().foreground('#10b981').bold()
const left = label.render('Left')
const right = label.render('Right')

// Join blocks side-by-side with spacing
console.log(joinHorizontal(2, left, right))

// Join blocks vertically with blank line spacing
console.log(joinVertical(1, 'Top', 'Middle', 'Bottom'))

// Place content inside a 20x5 area, centered
console.log(place(20, 5, 'center', 'center', label.render('Centered')))

Measurement Utilities

import { width, clampWidth, wrapWidth, padLines } from '@boba-cli/chapstick'

// Get display width (ANSI-aware)
width('\x1b[31mred\x1b[0m') // => 3

// Truncate to max width
clampWidth('hello world', 5) // => "hello"

// Word-wrap to max width
wrapWidth('hello world', 5) // => "hello\nworld"

// Pad lines with spaces
padLines('text', 2, 2) // => "  text  "

Terminal Detection

import { getColorSupport, getTerminalBackground } from '@boba-cli/chapstick'

const support = getColorSupport()
// { level: 3, hasBasic: true, has256: true, has16m: true }

const bg = getTerminalBackground()
// "dark" | "light" | "unknown"

Border Styles

Built-in border styles:

import { borderStyles } from '@boba-cli/chapstick'

borderStyles.normal // ┌─┐│ │└─┘
borderStyles.rounded // ╭─╮│ │╰─╯
borderStyles.bold // ┏━┓┃ ┃┗━┛
borderStyles.double // ╔═╗║ ║╚═╝

API

Types

  • HAlign - "left" | "center" | "right"
  • VAlign - "top" | "center" | "bottom"
  • Align - Alias for HAlign (backwards compatibility)
  • ColorInput - string | { light?: string; dark?: string }
  • BorderStyle - Border character definitions
  • Spacing - { top, right, bottom, left }
  • StyleOptions - All style configuration options
  • StyleKey - Keys of StyleOptions
  • ColorSupport - Color capability detection result
  • TerminalBackground - "dark" | "light" | "unknown"

Scripts

  • pnpm -C packages/chapstick build
  • pnpm -C packages/chapstick test
  • pnpm -C packages/chapstick lint
  • pnpm -C packages/chapstick generate:api-report

License

MIT