CI trace ansi colours 256 bold have no CSS due wrongly ansi2html light color variant conversion feature
Summary
when in a CI JOB trace an ansi xterm_colors_256 bold
f.i. \e[38;5;xxx;1m
is used, the Ansi2html conversion changes html class xterm-fg-xxx
to xterm-fg-l-xxx
while no CSS is defined for xterm-fg-l-xxx
in xterm.scss and thus results in bold white for any ansi_256_color
.
Steps to reproduce
In a ansi color capable runner, script:
echo -e "\033[38;5;82;1m * Prepare Environment: \033[0;m \n"
which will result in:
or
<span class="xterm-fg-l-82 term-bold"><br>* Prepare Environment:<br></span>
since no css object xterm-fg-l-82
is defined.
i.s.o.
Example Project
on request
What is the current bug behavior?
What is the expected correct behavior?
Relevant logs and/or screenshots
(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's very hard to read otherwise.)
Output of checks
This bug happens on GitLab.com
Possible fixes
in ansi2html.rb change line 226 from /fg-(\w{2,}+)/ to /fg-([a-z]{2,}+)/ .
this will not convert an xterm-fg-123
to xterm-fg-l-123
and since it is an custom colour, that light variant conversion for bold is of no use.
unless @fg_color.nil?
fg_color = @fg_color
# Most terminals show bold coloured text in the light colour variant
# Let's mimic that here
if @style_mask & STYLE_SWITCHES[:bold] != 0
- fg_color.sub!(/fg-(\w{2,}+)/, 'fg-l-\1')
+ fg_color.sub!(/fg-([a-z]{2,}+)/, 'fg-l-\1')
end
css_classes << fg_color
end
css_classes << @bg_color unless @bg_color.nil?