Go MIT

go-colorable

M

mattn

Dernière activité 29 mai 2026
mattn/go-colorable

817

étoiles

97

forks

7

issues ouvertes

colorgogolangwindows

Ce README est souvent en anglais.

go-colorable

Build Status Codecov GoDoc Go Report Card

Colorable writer for windows.

For example, most of logger packages doesn't show colors on windows. (I know we can do it with ansicon. But I don't want.) This package is possible to handle escape sequence for ansi color on windows.

Too Bad!

So Good!

Usage

logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true})
logrus.SetOutput(colorable.NewColorableStdout())

logrus.Info("succeeded")
logrus.Warn("not correct")
logrus.Error("something error")
logrus.Fatal("panic")

You can compile above code on non-windows OSs.

Installation

$ go get github.com/mattn/go-colorable

License

MIT

Author

Yasuhiro Matsumoto (a.k.a mattn)

Projets similaires

Color package for Go (golang)

Goansicolorcoloring
Ffatih
8 k étoiles649

🎨 Terminal color rendering library, support 8/16 colors, 256 colors, RGB color rendering output, support Print/Sprintf methods, compatible with Windows. GO CLI 控制台颜色渲染工具库,支持16色,256色,RGB色彩渲染输出,使用类似于 Print/Sprintf,兼容并支持 Windows 环境的色彩渲染

Go256-colorsclicli-color
Ggookit
1,6 k étoiles90

A general purpose syntax highlighter in pure Go

Goconsolegogolang
Aalecthomas
5 k étoiles528