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

Parse Terminal Colors #7

Open
RaitaroH opened this issue Jan 30, 2019 · 5 comments
Open

Parse Terminal Colors #7

RaitaroH opened this issue Jan 30, 2019 · 5 comments

Comments

@RaitaroH
Copy link

Not sure how to do it. The color itself simply ends up as the color code instead. Would be nice to have this to get some nice visual. I want my update icons for ex to change color so is more visible.

echo "$(tput setaf 1)Red text $(tput setab 7)and white background$(tput sgr 0)"
echo '\e[1;34m%-6s\e[m' "This is text"
@AndydeCleyre
Copy link

AndydeCleyre commented Mar 16, 2019

<font color="#a94d37">This text is orange</font>

@AndydeCleyre
Copy link

Unfortunately coloring the text this way mangles the spacing, as discussed in #12. So this issue should remain open until coloring the text preserves the text being colored.

Zren added a commit that referenced this issue Nov 15, 2019
While related to Issue #7, this does not parse+format terminal colors.

Add ConfigColor.qml
@Zren Zren changed the title Allow color Parse Terminal Colors Nov 15, 2019
@Zren
Copy link
Owner

Zren commented Sep 21, 2020

To https://www.pling.com/u/rumcho/, the widget does not parse terminal colors, but it can use an HTML subset:

https://doc.qt.io/qt-5/qml-qtquick-text.html#textFormat-prop

@joickle
Copy link

joickle commented Jan 10, 2022

You can use &nbsp; to re add spacing.

@Zren
Copy link
Owner

Zren commented Apr 29, 2022

Git master should now parse:

  • \033[m Reset
  • \033[0m Reset
  • \033[1m Bold
  • \033[30m - \033[37m FG Normal Colors
  • \033[90m - \033[97m FG Bright Colors
  • \033[1;30m Bold Normal Colors are automagically converted to Bright Colors (30 + 60 = 90)
  • \033[38;2;255m 8-Bit Preset Colors (Only Tested a couple colors in journalctl)
  • \033[38;5;255;255;255m RGB Color (Untested)

I've tested:

  • git -C ~/Code/plasma-applet-commandoutput log --oneline
  • git -C ~/Code/plasma-applet-commandoutput log --color --oneline
  • SYSTEMD_COLORS=1 journalctl -q -b0 -n20
    • \033[0;1;38;5;185m
    • \033[0;1;39m

Todo:

  • 39, which should not reset boldness (slightly annoying to implement).

Edit: Now should support 8-bit and RGB color mode.

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

4 participants