iBet uBet web content aggregator. Adding the entire web to your favor.
iBet uBet web content aggregator. Adding the entire web to your favor.



Link to original content: http://github.com/colored-rs/colored/issues/96
Enable Colors on Mac Terminal · Issue #96 · colored-rs/colored · GitHub
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

Enable Colors on Mac Terminal #96

Open
joshzeldin opened this issue Apr 5, 2021 · 7 comments
Open

Enable Colors on Mac Terminal #96

joshzeldin opened this issue Apr 5, 2021 · 7 comments
Labels
issue-needs-more-data Tag the issues that are pending for more data

Comments

@joshzeldin
Copy link

I'm struggling to get colors working on Mac OS (Catalina) when running through Terminal. I can get other CLIs with colors to display (e.g. ls, git, etc.), but colors coming from the colored package don't show up.

image

If I run the same thing through VS Code's terminal, the colors do show up.

image

Are you aware of any settings I need play with to get this working or limitations of the default terminal? I have tried these with no luck:

  • CLICOLOR
  • CLICOLOR_FORCE
  • NO_COLOR

I'm using the following:

[dependencies]
colored = "2.0.0"

Thanks and I'm really enjoying the crate!

@Dot32Dev
Copy link

Dot32Dev commented May 3, 2021

Also running MacOS Catalina, is working smoothly for me in terminal. Is it possible that your terminal profile has the ANSI colour setting turned off?

@grtcdr
Copy link

grtcdr commented May 17, 2021

Same issue on Windows, any luck so far?

@joshzeldin
Copy link
Author

@Dot32IsCool ANSI color is enabled under preferences. Thanks for the tip though.
@grtcdr Unfortunately no luck.

@grtcdr
Copy link

grtcdr commented May 28, 2021

Thanks for the update @joshzeldin

@mackwic
Copy link
Collaborator

mackwic commented Jun 30, 2022

Hi everyone,

Using this stackoverflow answer, I want what does the following script print ?

curl -s https://gist.githubusercontent.com/HaleTom/89ffe32783f89f403bba96bd7bcd1263/raw/ | bash

@mackwic mackwic added issue-needs-more-data Tag the issues that are pending for more data labels Jun 30, 2022
@usefulmove
Copy link

For me, the "s".truecolor() methods do not work as expected on macOS Terminal, but the color-specific methods (e.g., "s".green()) work perfectly. As has been mentioned, in the VSCode terminal, everything works across the board as far as I can tell.

@swpease
Copy link

swpease commented Sep 13, 2022

I seem to be in the same situation as usefulmove.

Here is the output for that colors script:
Screen Shot 2022-09-13 at 3 25 54 PM

And here is a demonstration of this crate's output for my terminal:
Screen Shot 2022-09-13 at 3 25 10 PM

Code for the above:

use colored::*;

fn main() {
    println!("{}", "black".black());
    println!("{}", "bright_black".bright_black());
    println!("{}", "red".red());
    println!("{}", "bright_red".bright_red());
    println!("{}", "green".green());
    println!("{}", "bright_green".bright_green());
    println!("{}", "yellow".yellow());
    println!("{}", "bright_yellow".bright_yellow());
    println!("{}", "truecolor_247,246,28".truecolor(247, 246, 28));
    println!("{}", "blue".blue());
    println!("{}", "bright_blue".bright_blue());
    println!("{}", "magenta".magenta());
    println!("{}", "bright_magenta".bright_magenta());
    println!("{}", "truecolor_255,76,255".truecolor(255, 76, 255));
    println!("{}", "purple".purple());
    println!("{}", "bright_purple".bright_purple());
    println!("{}", "cyan".cyan());
    println!("{}", "bright_cyan".bright_cyan());
    println!("{}", "white".white());
    println!("{}", "bright_white".bright_white());
    println!("{}", "truecolor_255,255,255".truecolor(255, 255, 255));
}

It looks like the 38;2;r;g;b syntax doesn't work for Terminal because it uses xterm-256color, i.e. it doesn't support truecolor. For reference, this script appears to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue-needs-more-data Tag the issues that are pending for more data
Projects
None yet
Development

No branches or pull requests

6 participants