Rainbow effect doesnt work.
Klausbdl opened this issue · comments
Klausbdl commented
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.
Klausbdl commented
how do I delete the issue
EricPlayZ commented
how do I delete the issue
You just close it lol.