public static bool SetForeGroundColor(ForeGroundColor foreGroundColor,bool brightColors) { IntPtr nConsole = GetStdHandle(STD_OUTPUT_HANDLE); int colorMap; if (brightColors) colorMap = (int) foreGroundColor | (int) ForeGroundColor.White; else colorMap = (int) foreGroundColor; return SetConsoleTextAttribute(nConsole, colorMap); }
public static bool SetForeGroundColor( ForeGroundColor foreGroundColor, bool brightColors) { // get the current console handle IntPtr nConsole = GetStdHandle(STD_OUTPUT_HANDLE); int colorMap; // if we want bright colors OR it with white if (brightColors) colorMap = (int) foreGroundColor | (int) ForeGroundColor.White; else colorMap = (int) foreGroundColor; // call the api and return the result return SetConsoleTextAttribute(nConsole, colorMap); }
public static bool SetForeGroundColor( ForeGroundColor foreGroundColor, bool brightColors) { // get the current console handle IntPtr nConsole = GetStdHandle(STD_OUTPUT_HANDLE); int colorMap; // if we want bright colors OR it with white if (brightColors) { colorMap = (int)foreGroundColor | (int)ForeGroundColor.White; } else { colorMap = (int)foreGroundColor; } // call the api and return the result return(SetConsoleTextAttribute(nConsole, colorMap)); }
public static bool SetForeGroundColor( ForeGroundColor foreGroundColor) { // default to a bright white-grey return(SetForeGroundColor(foreGroundColor, true)); }
public static bool SetForeGroundColor(ForeGroundColor foreGroundColor) { return SetForeGroundColor(foreGroundColor, false); }
public static bool SetForeGroundColor( ForeGroundColor foreGroundColor) { // default to a bright white-grey return SetForeGroundColor(foreGroundColor, true); }