Parse Terminal Colors
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"
<font color="#a94d37">This text is orange</font>
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.
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
You can use to re add spacing.
Git master should now parse:
-
\033[mReset -
\033[0mReset -
\033[1mBold -
\033[30m-\033[37mFG Normal Colors -
\033[90m-\033[97mFG Bright Colors -
\033[1;30mBold Normal Colors are automagically converted to Bright Colors (30 + 60 = 90) -
\033[38;2;255m8-Bit Preset Colors (Only Tested a couple colors injournalctl) -
\033[38;5;255;255;255mRGB 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.