Permalink
Browse files

ansi2html.sh: handle truecolor froeground/background escapes

  • Loading branch information...
1 parent 8cff543 commit 16d40765ceaaa20709d513d5bc01ba9e4f31feb5 Gyorgy Mora committed with Sep 14, 2017
Showing with 7 additions and 1 deletion.
  1. +7 −1 scripts/ansi2html.sh
View
@@ -32,7 +32,7 @@
# Handle codes with combined attributes and color.
# Handle isolated <bold> attributes with css.
# Strip more terminal control codes.
-# V0.23, 28 Feb 2016
+# V0.24, 14 Sep 2017
# http://github.com/pixelb/scripts/commits/master/scripts/ansi2html.sh
gawk --version >/dev/null || exit 1
@@ -235,6 +235,12 @@ sed "
# escape HTML (ampersand and quote done above)
s#>#\&gt;#g; s#<#\&lt;#g;
+# handle truecolor
+s#${p}38;2;\([0-9]\{1,3\}\);\([0-9]\{1,3\}\);\([0-9]\{1,3\}\)m#\
+<span style=\"color:rgb(\1\,\2\,\3\)\">#g
+s#${p}48;2;\([0-9]\{1,3\}\);\([0-9]\{1,3\}\);\([0-9]\{1,3\}\)m#\
+<span style=\"background-color:rgb(\1\,\2\,\3\)\">#g
+
# normalize SGR codes a little
# split 256 colors out and mark so that they're not

0 comments on commit 16d4076

Please sign in to comment.