or run

npx @tessl/cli init
Log in

Version

Files

docs

advanced-colors.mdbackground-colors.mdbasic-colors.mdcolor-support.mdconfiguration.mdindex.mdtext-styling.md
tile.json

task.mdevals/scenario-3/

Terminal Palette Previewer

Render color swatches and gradients using truecolor/256-color foreground and background styling to visualize arbitrary user-supplied colors.

Capabilities

Swatch rendering from mixed inputs

  • Given a list of named colors expressed as hex strings, RGB tuples, or 0–255 palette indices, it returns multi-line text where each line contains the name and a fixed-width background block filled with that color. @test
  • When labelUppercase is enabled, color names are uppercased before styling, but the color rendering remains unchanged. @test

Gradient preview

  • Produces a multi-line gradient preview for a label by blending between two provided colors across a configurable number of steps; each step applies a distinct foreground color while the background stays consistent. @test
  • When either endpoint color is provided as a 0–255 palette index, the output still honors the requested step count and applies the closest available hues. @test

Implementation

@generates

API

export type ColorInput = string | [number, number, number] | number;

export interface SwatchOptions {
  swatchWidth?: number;
  labelUppercase?: boolean;
}

/**
 * Builds a swatch table that previews each color with a colored label and background block.
 */
export function renderSwatches(
  entries: Array<{ name: string; value: ColorInput }>,
  options?: SwatchOptions
): string;

/**
 * Creates a gradient preview for a label by interpolating from startColor to endColor over the desired step count.
 */
export function renderGradient(
  label: string,
  startColor: ColorInput,
  endColor: ColorInput,
  steps: number
): string;

Dependencies { .dependencies }

chalk { .dependency }

Provides terminal string styling with truecolor and 256-color foreground/background helpers.