package colorprofile

Import Path
	github.com/charmbracelet/colorprofile (on go.dev)

Dependency Relation
	imports 13 packages, and imported by 3 packages

Involved Source Files Package colorprofile provides a way to downsample ANSI escape sequence colors and styles automatically based on output, environment variables, and Terminfo databases. env.go env_other.go profile.go writer.go
Package-Level Type Names (total 3, in which 2 are exported)
/* sort exporteds by: | */
Profile is a color profile: NoTTY, Ascii, ANSI, ANSI256, or TrueColor. Convert transforms a given Color to a Color supported within the Profile. String returns the string representation of a Profile. Profile : expvar.Var Profile : fmt.Stringer Profile : image/color.Model func Detect(output io.Writer, env []string) Profile func Env(env []string) (p Profile) func Terminfo(term string) (p Profile) func Tmux(env []string) Profile func github.com/charmbracelet/ultraviolet.ConvertLink(h uv.Link, p Profile) uv.Link func github.com/charmbracelet/ultraviolet.ConvertStyle(s uv.Style, p Profile) uv.Style func github.com/charmbracelet/ultraviolet.(*TerminalRenderer).SetColorProfile(profile Profile) func github.com/charmbracelet/ultraviolet.(*TerminalScreen).SetColorProfile(profile Profile) func charm.land/lipgloss/v2.Complete(p Profile) lipgloss.CompleteFunc const ANSI const ANSI256 const ASCII const Ascii const NoTTY const TrueColor const Unknown
Writer represents a color profile writer that writes ANSI sequences to the underlying writer. Forward io.Writer Profile Profile Write writes the given text to the underlying writer. WriteString writes the given text to the underlying writer. *Writer : internal/bisect.Writer *Writer : io.StringWriter *Writer : io.Writer func NewWriter(w io.Writer, environ []string) *Writer var charm.land/lipgloss/v2.Writer *Writer
Package-Level Functions (total 16, in which 5 are exported)
Detect returns the color profile based on the terminal output, and environment variables. This respects NO_COLOR, CLICOLOR, and CLICOLOR_FORCE environment variables. The rules as follows: - TERM=dumb is always treated as NoTTY unless CLICOLOR_FORCE=1 is set. - If COLORTERM=truecolor, and the profile is not NoTTY, it gest upgraded to TrueColor. - Using any 256 color terminal (e.g. TERM=xterm-256color) will set the profile to ANSI256. - Using any color terminal (e.g. TERM=xterm-color) will set the profile to ANSI. - Using CLICOLOR=1 without TERM defined should be treated as ANSI if the output is a terminal. - NO_COLOR takes precedence over CLICOLOR/CLICOLOR_FORCE, and will disable colors but not text decoration, i.e. bold, italic, faint, etc. See https://no-color.org/ and https://bixense.com/clicolors/ for more information.
Env returns the color profile based on the terminal environment variables. This respects NO_COLOR, CLICOLOR, and CLICOLOR_FORCE environment variables. The rules as follows: - TERM=dumb is always treated as NoTTY unless CLICOLOR_FORCE=1 is set. - If COLORTERM=truecolor, and the profile is not NoTTY, it gest upgraded to TrueColor. - Using any 256 color terminal (e.g. TERM=xterm-256color) will set the profile to ANSI256. - Using any color terminal (e.g. TERM=xterm-color) will set the profile to ANSI. - Using CLICOLOR=1 without TERM defined should be treated as ANSI if the output is a terminal. - NO_COLOR takes precedence over CLICOLOR/CLICOLOR_FORCE, and will disable colors but not text decoration, i.e. bold, italic, faint, etc. See https://no-color.org/ and https://bixense.com/clicolors/ for more information.
NewWriter creates a new color profile writer that downgrades color sequences based on the detected color profile. If environ is nil, it will use os.Environ() to get the environment variables. It queries the given writer to determine if it supports ANSI escape codes. If it does, along with the given environment variables, it will determine the appropriate color profile to use for color formatting. This respects the NO_COLOR, CLICOLOR, and CLICOLOR_FORCE environment variables.
Terminfo returns the color profile based on the terminal's terminfo database. This relies on the Tc and RGB capabilities to determine if the terminal supports TrueColor. If term is empty or "dumb", it returns NoTTY.
Tmux returns the color profile based on `tmux info` output. Tmux supports overriding the terminal's color capabilities, so this function will return the color profile based on the tmux configuration.
Package-Level Variables (total 2, neither is exported)
Package-Level Constants (total 8, in which 7 are exported)
ANSI is a profile with 16 colors (4-bit).
ANSI256 is a profile with 256 colors (8-bit).
ASCII is a profile with no color support.
Ascii is an alias for the [ASCII] profile for backwards compatibility.
NoTTY is a profile with no terminal support.
TrueColor is a profile with 16 million colors (24-bit).
Unknown is a profile that represents the absence of a profile.