d-colorize icon indicating copy to clipboard operation
d-colorize copied to clipboard

Colors not reset properly with only fg.init or bg.init

Open vladdeSV opened this issue 9 years ago • 1 comments

import std.stdio;
import colorize;

void main()
{
    string a = color("a", fg.light_green, bg.light_red);
    string b = color("b", fg.red, bg.init);

    cwriteln(a, b);
}

This code should print out a green a with a red background, then a red b, with the default background color as background. However, the results end up with the b having the same background color as a.

coltest

This is not the expected behavior, as setting both b's foreground and background to init gives the default colors of the console.

This bug happens only on Windows, not POSIX.

Tested on Windows 7 64-bit (CMD.exe, Powershell.exe), GNU+Linux Debian 64-bit (terminator, gnome-terminal), OS X some-bit (thenameoftheterminalthere).

Yoyo, vladde

vladdeSV avatar Jul 11 '15 10:07 vladdeSV

If you wish you could reverse the fg and bg, string b = color("b", fg.init, bg.blue); will make the foreground green.

vladdeSV avatar Jul 11 '15 10:07 vladdeSV