Closed
Description
I came across a weird behavior while using the library - if background color (e.g. 42 - green) is specified before foreground (e.g. 30 - black) the render will contain black text on black background. Weirdly enough this happens only for separated sequences (e.g. ^[[0m^[[42m^[[30m
) and not while parsing their short forms (e.g. ^[[42;30m
).
I used following example to demonstrate the problem (also attached):
Download raw
^[[30;42mWORKS1^[[0m
^[[0m^[[42m^[[30mDOESNT1^[[0m
^[[0m^[[30m^[[42mWORKS2^[[0m
^[[42;30mWORKS1^[[0m
Rendering in GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu)
HTML from ansi-to-html v1.1.3
<?php
$output = (new AnsiToHtmlConverter())->convert($test);
<span style="background-color: green; color: black">WORKS1</span><span style="background-color: black; color: white"><br />
</span><span style="background-color: black; color: black">DOESNT1</span><span style="background-color: black; color: white"><br />
</span><span style="background-color: green; color: white">WORKS2</span><span style="background-color: black; color: white"><br />
</span><span style="background-color: green; color: black">WORKS1</span><span style="background-color: black; color: white"><br />
</span>
Metadata
Metadata
Assignees
Labels
No labels