whatisgithub

What is ansi-cut?

sholderbach/ansi-cut — explained in plain English

Analysis updated 2026-07-18 · repo last pushed 2022-01-17

Audience · developerComplexity · 2/5DormantSetup · easy

In one sentence

A small library that trims or slices colored terminal text without breaking the color codes, so truncated output still looks right.

Mindmap

mindmap
  root((repo))
    What it does
      Slices ANSI text
      Preserves colors
      Splits into chunks
    Tech stack
      ANSI escape codes
    Use cases
      Terminal UIs
      Log viewers
      CLI tables
    Audience
      Developers
      CLI tool builders
    Functions
      cut by range
      chunks fixed size

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Truncate color-coded log lines to fit a narrow terminal column without losing formatting.

USE CASE 2

Build a terminal dashboard that slices colored text safely for display.

USE CASE 3

Split colored strings into fixed-size chunks for a CLI table layout.

USE CASE 4

Fix broken color output caused by naive string truncation in a command-line tool.

What is it built with?

ANSI escape codes

How does it compare?

sholderbach/ansi-cut0verflowme/alarm-clock0verflowme/seclists
LanguageCSS
Last pushed2022-01-172022-10-032020-05-03
MaintenanceDormantDormantDormant
Setup difficultyeasyeasyeasy
Complexity2/52/51/5
Audiencedevelopervibe coderops devops

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Copy-paste prompts

Prompt 1
Show me how to use ansi-cut's cut function to slice a colored string by character range.
Prompt 2
Help me use ansi-cut's chunks function to split a colored log line into fixed-size pieces.
Prompt 3
Explain why naive string slicing breaks ANSI color codes and how ansi-cut avoids that.
Prompt 4
Write an example that truncates colored log output to fit a fixed-width terminal column using ansi-cut.

Frequently asked questions

What is ansi-cut?

A small library that trims or slices colored terminal text without breaking the color codes, so truncated output still looks right.

Is ansi-cut actively maintained?

Dormant — no commits in 2+ years (last push 2022-01-17).

How hard is ansi-cut to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is ansi-cut for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.