Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add termenv aware environment variables #134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -378,6 +381,23 @@ You can help improve this list! Check out [how to](ansi_compat.md) and open an i

</details>

## 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
Expand Down