jenkinscolorsjenkins-pipelineansi-escape

How to Reconfigure Jenkins Ansi-Color Plugin ColorMap for MSBuild?


Colorized console output for Jenkins is nice but the default white background makes yellow text extremely difficult to read. The Blue Ocean plugin solved this by re-coloring yellow text to a burnt orange which shows up equally well on white/black backgrounds.

Since Blue Ocean is deprecated and it's not always convenient to load it up, I've been looking at ANSI-Color plugin color maps to remap yellow to orange. Problem is, I can't get it to actually swap the color.

Based on the docs, it should be simple enough to go to "Manage Jenkins"->System->"ANSI Color"->Advanced and globally update the "xterm" color mapping for Yellow from #CDCD00 to #FF8700 (which is a valid ANSI 256 color per wikipedia).

Adding options { ansiColor('xterm') } to my Jenkinsfile at the pipeline scope gives me colored output from dotnet build as expected but in the Console Output I just get yellow text instead of the replacement value.

In the browser, I can see that escape codes are being labeled in the page source and that it's using the default hex code. If I manually change the hex code to #FF8700 the text changes to the correct color so it doesn't seem as if the color can't be rendered.

<pre class="console-output">MSBuild version 17.9.4+90725d08d for .NET
  Creating a model to represent the project...
  Loading project references...
  Loading project files...
  Building the project model and resolving object interdependencies...
  Validating the project model...
  Writing model to /jenkins/workspace/<redacted>...
<!--[39;49m--><!--[33m--><span style="color: #CDCD00;">/jenkins/workspace<redacted>
...

Is there a trick to this that I'm missing?


Solution

  • Good news, I figured it out. This boiled down to a misinterpretation of the interface. In my defense, it was unclear what the fields were meant for as they are unlabeled.

    Originally, I thought that field 1 was the input color and field 2 was the transform color. Only after looking at the html code for clues and seeing the fields named checkYellow and checkYellowB did it dawn on me that each field was the color to apply to Normal and Bold text respectively. So updating the first field with my desired color was the solution to the problem.

    As an aside, I've found that #CC5500 is my preferred shade of orange for this.

    enter image description here