Documentation ¶
Overview ¶
Package termcolor detects what level of color support your terminal has.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Supports16M ¶
func Supports16M(f FileDescriptor) bool
Supports16M returns true if the file descriptor can support true colors.
func Supports256 ¶
func Supports256(f FileDescriptor) bool
Supports256 returns true if the file descriptor can support 256 colors.
func SupportsBasic ¶
func SupportsBasic(f FileDescriptor) bool
SupportsBasic returns true if the file descriptor can support the basic 16 colors.
func SupportsNone ¶
func SupportsNone(f FileDescriptor) bool
SupportNone returns true if the file descriptor cannot support colors.
Types ¶
type FileDescriptor ¶
type FileDescriptor interface {
Fd() uintptr
}
FileDescriptor is the interface that wraps the file descriptor method.
type Level ¶
type Level int
Level represents the number of colors the terminal supports.
const ( // LevelNone represents a terminal that does not support colors. LevelNone Level = iota // LevelBasic represents a terminal that can support the basic 16 colors. LevelBasic // Level256 represents a terminal that can support 256 colors. Level256 // Level16M represents a terminal that can support "true colors". Level16M )
Color levels that can be supported by a terminal. See https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
func SupportLevel ¶
func SupportLevel(f FileDescriptor) Level
SupportLevel returns the color level that's supported by the file descriptor. If the environment variables set no color, then returns LevelNone.