tomakita / Colorful.Console

Style your .NET console output!

Repository from Github https://github.comtomakita/Colorful.ConsoleRepository from Github https://github.comtomakita/Colorful.Console

Rainbow effect doesnt work.

Klausbdl opened this issue · comments

I'm trying to achieve a rainbow effect changing the RGB values as such:

Program:

Color color = Color.FromArgb(0,0,0);
while (true)
            {
                color = Rainbow(color);
                Console.WriteLine(color.R + " " + color.G + " " + color.B, color);
                System.Threading.Thread.Sleep(50);
            }

Function:

public static Color Rainbow(Color color)
        {
            int r = color.R;
            int g = color.G;
            int b = color.B;

            if (color.G == 0 && color.B == 0 && color.R < 255)
            {
                r += 5;
            }

            else if (color.G == 0 && color.B < 255 && color.R == 255)
            {
                b += 5;
            }

            else if (color.G == 0 && color.B == 255 && color.R > 0)
            {
                r -= 5;
            }

            else if (color.G < 255 && color.B == 255 && color.R == 0)
            {
                g += 5;
            }

            else if (color.G == 255 && color.B > 0 && color.R == 0)
            {
                b -= 5;
            }

            else if (color.G == 255 && color.B == 0 && color.R < 255)
            {
                r += 5;
            }

            else if (color.G > 0 && color.B == 0 && color.R == 255)
            {
                g -= 5;
            }

            return Color.FromArgb(r, g, b);
        }

At first, this increases the value of R from 0 to 255. Although the numbers change, the color of the text doesn't after some while-loop interations.
Looks like this: https://prnt.sc/twqtij
Is it a bug or am I doing something wrong?

Thanks in advance.

how do I delete the issue

how do I delete the issue

You just close it lol.