public static string ColourToCSSHexValue(this TerminalColour colour) { switch (colour) { case TerminalColour.White: return("#FFFFFF"); case TerminalColour.Black: return("#5E5C64"); case TerminalColour.Red: return("#F66151"); case TerminalColour.Green: return("#33DA7A"); case TerminalColour.Yellow: return("#E9AD0C"); case TerminalColour.Blue: return("#2A7BDE"); case TerminalColour.Magenta: return("#C061CB"); case TerminalColour.Cyan: return("#33C7DE"); case TerminalColour.DarkWhite: return("#D0CFCC"); case TerminalColour.DarkBlack: return("#171421"); case TerminalColour.DarkRed: return("#C01C28"); case TerminalColour.DarkGreen: return("#26A269"); case TerminalColour.DarkYellow: return("#A2734C"); case TerminalColour.DarkBlue: return("#12488B"); case TerminalColour.DarkMagenta: return("#A347BA"); case TerminalColour.DarkCyan: return("#2AA1B3"); default: throw new ArgumentOutOfRangeException(nameof(colour), colour, null); } }
private static TerminalColour HandleColourCommand(string commands, TerminalColour sectionColour) { foreach (var command in commands.Split(';')) { var code = Convert.ToInt32(command); switch (code) { case 0: sectionColour = DefaultColour; break; case 30: sectionColour = TerminalColour.DarkBlack; break; case 31: sectionColour = TerminalColour.DarkRed; break; case 32: sectionColour = TerminalColour.DarkGreen; break; case 33: sectionColour = TerminalColour.DarkYellow; break; case 34: sectionColour = TerminalColour.DarkBlue; break; case 35: sectionColour = TerminalColour.DarkMagenta; break; case 36: sectionColour = TerminalColour.DarkCyan; break; case 37: sectionColour = TerminalColour.DarkWhite; break; case 39: sectionColour = DefaultColour; break; case 90: sectionColour = TerminalColour.Black; break; case 91: sectionColour = TerminalColour.Red; break; case 92: sectionColour = TerminalColour.Green; break; case 93: sectionColour = TerminalColour.Yellow; break; case 94: sectionColour = TerminalColour.Blue; break; case 95: sectionColour = TerminalColour.Magenta; break; case 96: sectionColour = TerminalColour.Cyan; break; case 97: sectionColour = TerminalColour.White; break; } } return(sectionColour); }