~jpgleeson/spawsh

a10f438c238be8ad91a99b9fa3d523e3da1c8926 — Jack Gleeson 7 months ago e224b85
Colour header text. Red for top level, green for others
1 files changed, 15 insertions(+), 1 deletions(-)

M Program.cs
M Program.cs => Program.cs +15 -1
@@ 498,7 498,21 @@ namespace spawsh
                {
                    if (DisplayBuffer[i] != null)
                    {
                        Console.WriteLine(DisplayBuffer[i]);
                        if (DisplayBuffer[i].Length > 0 && DisplayBuffer[i][0] == '#') {
                            var originalColour = Console.ForegroundColor;
                            int headerLevel = DisplayBuffer[i].Split('#').Length - 1;
                            if (headerLevel == 1) {
                                Console.ForegroundColor = ConsoleColor.Red;
                            } else {
                                Console.ForegroundColor = ConsoleColor.Green;
                            }
                            
                            string outString = DisplayBuffer[i].Replace("#", string.Empty);
                            Console.WriteLine(outString);
                            Console.ForegroundColor = originalColour;
                        } else {
                            Console.WriteLine(DisplayBuffer[i]);
                        }
                    }
                }
            }