silkfire / Pastel

Snazz up your console output!
MIT License
405 stars 24 forks source link

Background is not applied after a 2nd color is applied #37

Open antar4 opened 1 week ago

antar4 commented 1 week ago

If you apply color to two or more strings and then apply background color to the entire line, the background color is displayed ONLY in the first string and empty space

Reproduce:

            // Setup
            string t1 = "HELLO ";
            string t2 = "WORLD";

            t1 = t1.Pastel(Color.Yellow);
            t2 = t2.Pastel(Color.Red);

            // Execution 1
            StringBuilder sb = new StringBuilder();
            sb.Append(t1);
            sb.Append(t2);
            string line = sb.ToString().PadRight(110);
            line = line.PastelBg(Color.Blue);

            Console.WriteLine(line);

            // Execution 2
            string t = t1 + t2;
            t = t.PadRight(110);
            t = t.PastelBg(Color.Blue);
            Console.WriteLine(t);

Result: image

Expected: The word "WORLD" should also have a blue background.

Note: This behavior is new, previous version was working as intended.

silkfire commented 4 days ago

Thanks for reporting the issue. I'll take a look at it as soon as I have time.