From 8ce1138af0674d972afbcc7a063fafa913ad3703 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Fri, 14 Apr 2023 17:46:59 -0400 Subject: [PATCH] docs: add termenv aware environment variables Explain a bit how some environment variables might affect Termenv. --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index 29dcf01..25e1fc2 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,9 @@ the profile you want to use: ```go output := termenv.NewOutput(os.Stdout, termenv.WithProfile(termenv.TrueColor)) + +# or... +output.Profile = termenv.ANSI256 ``` ## Colors @@ -378,6 +381,23 @@ You can help improve this list! Check out [how to](ansi_compat.md) and open an i +## Environment Variables + +Termenv is aware of some specific environment variables and based on those, it +makes different decisions regarding color support. + +- `TERM` is set by the terminal program and gives information about the terminal type. +- `COLORTERM` when set to `truecolor`, it enables the `TrueColor` profile. + `24bit`, `true`, and `yes` enables the `ANSI256` profile. +- `COLORFGBG` helps detect terminal background and foreground colors if the + terminal doesn't support OSC 10/11. +- `CLICOLOR_FORCE` when set to a non-empty value, enables basic colors using + the `ANSI` profile. +- `NO_COLOR` when set and non-empty, disables terminal colors. +- `CLICOLOR` when set to `0` and `CLICOLOR_FORCE` is not set or empty, will disables terminal colors. +- `CI` when set and non-empty, assumes that terminal is not a TTY. +- `GOOGLE_CLOUD_SHELL` when set to `true`, enables the `TrueColor` profile. + ## Platform Support `termenv` works on Unix systems (like Linux, macOS, or BSD) and Windows. While