public class Utils
{
public static void LogDebug(string debuglog)
{
Console.WriteLine($"[Debug] {debuglog}", System.Drawing.Color.Yellow;); //That $ passes the arg(string log) into the string function thus printing it into console
}
public static void InfoLog(string infolog)
{
Console.WriteLine($"[Info] {infolog}",);
}
public static void WarningLog(string warning)
{
Console.WriteLine($"[Warn] {warning}",);
}
}
}
나는이 코드를 사용하여 오류를 식별하고 주위를 둘러싼 것들을 식별 할 수있게 도와 주었지만, 모두 흰색이라면 정말 도움이되지 않습니다. 당신이 System.Drawing.Color.Yellow;
Util을위한 컬러 텍스트
대신
해당 색상에 기록 된 모든 텍스트를 변경Console.BackgroundColor = ConsoleColor.Blue;
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("White on blue.");
Console.WriteLine("Another line.");
같이 입력 쉽게 무언가에 대해 알고 있다면 내가 당신을 부탁 해요 이유입니다. 내가 색을 바꾼다는 단순한 요청이 모두 흰색으로 돌아 가기를 바랄뿐입니다.
굉장! 그것은 Utils를위한 제 코드에서 정말 잘 맞습니다. – WhiteGlove