gleamtea/color

A small, electric colour palette inspired by Charmbracelet’s Charm brand (lipgloss/bubbletea), bound from beamtea’s beamtea_color.

Each name maps to an xterm-256 index so it renders on any modern terminal. The Color constructors compile to exactly the atoms beamtea_color expects, so these calls cross the FFI with no translation.

import gleamtea/color
color.fg(color.Hotpink, "hi")

Types

A named palette colour.

pub type Color {
  Charmple
  Purple
  Indigo
  Violet
  Lavender
  Hotpink
  Pink
  Magenta
  Fuchsia
  Cyan
  Aqua
  Teal
  Blue
  Sky
  Green
  Lime
  Mint
  Yellow
  Gold
  Orange
  Coral
  Red
  White
  Cloud
  Gray
  Dim
  Charcoal
}

Constructors

  • Charmple
  • Purple
  • Indigo
  • Violet
  • Lavender
  • Hotpink
  • Pink
  • Magenta
  • Fuchsia
  • Cyan
  • Aqua
  • Teal
  • Blue
  • Sky
  • Green
  • Lime
  • Mint
  • Yellow
  • Gold
  • Orange
  • Coral
  • Red
  • White
  • Cloud
  • Gray
  • Dim
  • Charcoal

Values

pub fn all() -> List(Color)

Every colour in the palette, in display order.

pub fn bg(color: Color, text: String) -> String

Paint text with a named background colour.

pub fn fg(color: Color, text: String) -> String

Paint text with a named foreground colour.

pub fn index(color: Color) -> Int

The underlying xterm-256 index (0–255) for a named colour.

pub fn name(color: Color) -> String

The lowercase name of a colour, e.g. name(Hotpink) == "hotpink".

Search Document