File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3232# Handle codes with combined attributes and color.
3333# Handle isolated <bold> attributes with css.
3434# Strip more terminal control codes.
35- # V0.23, 28 Feb 2016
35+ # V0.24, 14 Sep 2017
3636# http://github.com/pixelb/scripts/commits/master/scripts/ansi2html.sh
3737
3838gawk --version > /dev/null || exit 1
@@ -235,6 +235,12 @@ sed "
235235# escape HTML (ampersand and quote done above)
236236s#>#\>#g; s#<#\<#g;
237237
238+ # handle truecolor
239+ s#${p} 38;2;\([0-9]\{1,3\}\);\([0-9]\{1,3\}\);\([0-9]\{1,3\}\)m#\
240+ <span style=\" color:rgb(\1\,\2\,\3\)\" >#g
241+ s#${p} 48;2;\([0-9]\{1,3\}\);\([0-9]\{1,3\}\);\([0-9]\{1,3\}\)m#\
242+ <span style=\" background-color:rgb(\1\,\2\,\3\)\" >#g
243+
238244# normalize SGR codes a little
239245
240246# split 256 colors out and mark so that they're not
You can’t perform that action at this time.
0 commit comments