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

fix: add xterm and rio color profiles #22

Merged
merged 5 commits into from
Dec 12, 2024
Merged

fix: add xterm and rio color profiles #22

merged 5 commits into from
Dec 12, 2024

Conversation

aymanbagabas
Copy link
Member

This adds TERM=rio as a TrueColor profile and TERM=xterm as an ANSI profile.

Copy link
Member

@caarlos0 caarlos0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noice

@meowgorithm
Copy link
Member

TERM=@raphamorim 👀

@raphamorim
Copy link

let's goooo
image

caarlos0 added a commit to muesli/termenv that referenced this pull request Dec 11, 2024
caarlos0 added a commit to muesli/termenv that referenced this pull request Dec 11, 2024
@caarlos0
Copy link
Member

honestly liked it better checking whole terminal names instead of splitting by - 🤔

@meowgorithm
Copy link
Member

I think I agree, for readability and to decrease ambiguity.

@aymanbagabas
Copy link
Member Author

honestly liked it better checking whole terminal names instead of splitting by - 🤔

Some terminals like st have different variants, such as st-256color and st-meta. There's also xterm-direct that we should add, which also supports true colors.

@caarlos0
Copy link
Member

@aymanbagabas i would prob just add all of them statically 🤔

@aymanbagabas
Copy link
Member Author

@aymanbagabas i would prob just add all of them statically 🤔

@caarlos0 This PR build on this one and adds support for Terminfo and queries Tmux #24

@aymanbagabas
Copy link
Member Author

@aymanbagabas i would prob just add all of them statically 🤔

We will keep adding more and more, like I just noticed that there's a foot-direct and alacritty-direct.

env.go Outdated Show resolved Hide resolved
env.go Outdated Show resolved Hide resolved
This adds two new functions to detect the color profile based on the
terminal's terminfo database and tmux configuration. The `Terminfo`
function 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. The `Tmux` function returns the color
profile based on `tmux info` output. Tmux supports overriding the
terminal's terminfo database, so this function will return the color
profile based on `tmux info` output which is taken from the tmux
configurations.

Now, `Detect` will return the minimum of the color profile based on the
environment, terminfo, and tmux. This ensures that the color profile is
the most accurate based on the terminal's capabilities.

Environment variables take precedence over terminfo and tmux.
@aymanbagabas aymanbagabas merged commit 9d6ebea into main Dec 12, 2024
25 checks passed
@aymanbagabas aymanbagabas deleted the xterm-rio branch December 12, 2024 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants