📉ConsoleBase - NKS0005
Use SetConsoleColor(Color, true) from KernelColorTools
This analyzer provides the following strings:
Context | String |
---|---|
Error List | Caller uses |
Suggestion Box | Use |
Description |
|
Extended Description
This code analyzer detects the usage of BackgroundColor
from the standard Console
class found in the System
namespace. This property only supports up to 16 colors, and, in order to upgrade to 255 colors or true color, you need to have a console that supports it and a VT escape sequence to be able to set the background color of the console in any color you want.
As a result, SetConsoleColor
simplifies things up by using the Color
class provided by Terminaux to be able to set the color without being restricted to the domain of the 16 colors.
Analysis Comparison
To get a brief insight about how this analyzer works, compare the two code blocks shown to you below:
Before the fix
After the fix
Suppression
You can suppress this suggestion by including it in the appropriate place, whichever is convenient.
For more information about how to suppress any warning issued by the Nitrocid analyzer, visit the below page:
Recommendation
We recommend that every caller which use this property use the recommended abovementioned method.
Last updated