Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. go-colorable

go-colorable

MITGo

A Go library that enables ANSI color escape sequences in terminal output on Windows.

Visit WebsiteGitHubGitHub
811 stars97 forks0 contributors

What is go-colorable?

go-colorable is a Go library that enables ANSI color escape sequences to work properly in terminal output on Windows systems. It solves the problem where most logger packages and command-line tools fail to display colored text on Windows terminals, providing cross-platform compatibility for colorful console applications.

Target Audience

Go developers building command-line tools, logging systems, or terminal applications that need consistent colored output across Windows and other operating systems.

Value Proposition

Developers choose go-colorable because it provides a pure Go solution for Windows color support without requiring external dependencies like ansicon, enabling seamless cross-platform development with colorful terminal output.

Overview

go-colorable is a Go library that provides colorable writers for Windows terminals, allowing ANSI escape sequences for colored output to work properly. It solves the common problem where most logger packages fail to display colors on Windows systems, enabling developers to maintain consistent, colorful terminal output across all platforms.

Key Features

  • Windows ANSI Support — Enables proper handling of ANSI color escape sequences on Windows terminals
  • Cross-Platform Compatibility — Code using this library can be compiled and run on both Windows and non-Windows operating systems
  • Logger Integration — Works seamlessly with popular logging packages like logrus to enable colored output
  • Simple API — Provides straightforward functions like NewColorableStdout() for easy integration into existing applications

Philosophy

go-colorable follows a pragmatic approach to solving the Windows color problem without requiring external tools like ansicon, providing a native Go solution that works across platforms.

Use Cases

Best For

  • Adding colored output to Go CLI tools that run on Windows
  • Enabling colored logging in Go applications across all platforms
  • Building cross-platform terminal applications with consistent color display
  • Integrating with logging packages like logrus for Windows color support
  • Creating developer tools that use ANSI escape sequences for better UX
  • Maintaining visual consistency in terminal output between Unix and Windows systems

Not Ideal For

  • Projects that run exclusively on Unix-like operating systems and have no Windows deployment plans
  • Applications using alternative terminal libraries like termenv or charm that already provide cross-platform color support out-of-the-box
  • Environments where dependency minimization is critical, and colored output is a non-essential feature

Pros & Cons

Pros

Native Windows Color Support

Enables proper handling of ANSI escape sequences on Windows terminals without external tools like ansicon, as highlighted in the README's philosophy for a pure Go solution.

Seamless Cross-Platform Compatibility

Code can be compiled and run on both Windows and non-Windows OSs, ensuring consistent colorful output everywhere, demonstrated by the usage example that works across platforms.

Easy Logger Integration

Integrates smoothly with popular logging packages like logrus, as shown in the README with examples for setting up colored output via SetOutput and NewColorableStdout().

Simple and Minimal API

Provides straightforward functions such as NewColorableStdout(), making it easy to add color support to existing applications with minimal code changes.

Cons

Limited to Basic ANSI Sequences

Only handles ANSI color escape sequences, lacking support for more advanced terminal features like cursor control or extended color palettes, which might be needed for richer UIs.

Unnecessary Overhead on Unix

On non-Windows systems, go-colorable adds an extra dependency and processing layer that is redundant since ANSI sequences work natively, increasing binary size without benefit.

Manual Setup per Writer

Requires configuration for each output stream (e.g., stdout, stderr), as seen in the usage code, which can be cumbersome in applications with multiple writers or complex logging setups.

Frequently Asked Questions

Quick Stats

Stars811
Forks97
Contributors0
Open Issues7
Last commit3 months ago
CreatedSince 2014

Tags

#windows-compatibility#go-library#color#ansi-escape-sequences#logging#golang#cross-platform#go#cli-tools#console-output#windows#terminal-colors

Built With

G
Go

Links & Resources

Website

Included in

Go169.1k
Auto-fetched 10 hours ago

Related Projects

bubbleteabubbletea

A powerful little TUI framework 🏗

Stars44,839
Forks1,312
Last commit6 days ago
fxfx

Terminal JSON viewer & processor

Stars20,620
Forks486
Last commit13 days ago
termuitermui

Golang terminal dashboard

Stars13,581
Forks819
Last commit1 year ago
lipglosslipgloss

Style definitions for nice terminal layouts 👄

Stars11,800
Forks392
Last commit2 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub