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

feat: globally enable colored terminal output? #315

Closed
calebdw opened this issue Jul 29, 2024 · 4 comments
Closed

feat: globally enable colored terminal output? #315

calebdw opened this issue Jul 29, 2024 · 4 comments

Comments

@calebdw
Copy link
Contributor

calebdw commented Jul 29, 2024

Hello!

Would it be possible to add a config option (or just set it globally) to enable terminal colors in the output from programs? It would be nice to globally enable so that I don't have to specifically configure every command to output color:

e.g.,

```bash +exec
ls -alh
```
<!-- instead of -->
```bash +exec
ls -alh --color=always
```

Thanks!

@mfontanini
Copy link
Owner

I imagine tools will look up some specific environment variable like TERM to figure out color support. However, I think before doing this, color support should work better (see #272 and there's an open PR that needs some work still). I was meaning to get to that but I was busy and prioritized the 0.8 release over this. I'll bump it up in my priority list.

@mfontanini
Copy link
Owner

Okay so looking at this it may not be that simple. Tools seem to check if they're running in a tty before enabling color when you use "auto" color mode (e.g. ls, grep, etc). The TERM thing I mentioned above would not work because that is always set so that'd mean if you do files=$(ls) then you'd have colored output in $files and that's not desireable.

I don't know if there's another solution but using a tty will be a huge amount of work as it will cause tools to use a wider range of escape codes that we'll need to deal with, like moving the cursor around, so I don't want to go that route.

@calebdw
Copy link
Contributor Author

calebdw commented Aug 2, 2024

Ah, well that's good to know!

@calebdw calebdw closed this as not planned Won't fix, can't repro, duplicate, stale Aug 2, 2024
@henryiii
Copy link

henryiii commented Aug 2, 2024

Lots of tools use FORCE_COLOR, so if there was a way to set environment variables, that would likely mostly solve it.

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

No branches or pull requests

3 participants