Beispiel #1
0
        public static string ColorANSI16(ANSIColor_16 foreground)
        {
            int fgColor = (int)foreground + 30;
            int bold    = 0;

            if (fgColor >= 40)
            {
                bold = 1; fgColor -= 10;
            }

            return(string.Format("{0}[{2};{1}m", (char)27, fgColor, bold));
        }
Beispiel #2
0
        public static string ColorANSI16(ANSIColor_16 foreground, ANSIColor_8 background)
        {
            int bgColor = (int)background + 40;
            int fgColor = (int)foreground + 30;
            int bold    = 0;

            if (fgColor >= 40)
            {
                bold = 1; fgColor -= 10;
            }

            return(string.Format("{0}[{1};{2};{3}m", (char)27, bold, fgColor, bgColor));
        }
Beispiel #3
0
 public static string SetColorANSI16(string text, ANSIColor_16 foreground)
 {
     return(string.Format("{0}{1}{2}", ColorANSI16(foreground), text, ClearFormat()));
 }