Controls, Startup&Driver improvements

This commit is contained in:
2023-08-09 11:54:32 +02:00
parent 2528487ff6
commit d549733b71
49 changed files with 875 additions and 120 deletions

View File

@@ -1,14 +0,0 @@
using System.ComponentModel;
namespace TerminalUI.Models;
public record struct Color256(byte Color, ColorType Type) : IColor
{
public string ToConsoleColor()
=> Type switch
{
ColorType.Foreground => $"\x1b[38;5;{Color}m",
ColorType.Background => $"\x1b[48;5;{Color}m",
_ => throw new InvalidEnumArgumentException(nameof(Type), (int) Type, typeof(ColorType))
};
}

View File

@@ -1,14 +0,0 @@
using System.ComponentModel;
namespace TerminalUI.Models;
public record struct ColorRgb(byte R, byte G, byte B, ColorType Type) : IColor
{
public string ToConsoleColor()
=> Type switch
{
ColorType.Foreground => $"\x1b[38;2;{R};{G};{B};m",
ColorType.Background => $"\x1b[48;2;{R};{G};{B};m",
_ => throw new InvalidEnumArgumentException(nameof(Type), (int) Type, typeof(ColorType))
};
}

View File

@@ -1,8 +0,0 @@
namespace TerminalUI.Models;
public enum ColorType
{
Unknown,
Foreground,
Background
}

View File

@@ -1,83 +0,0 @@
namespace TerminalUI.Models;
public static class Color256Colors
{
public static class Backgrounds
{
public static readonly Color256 Black = new(0, ColorType.Background);
public static readonly Color256 Blue = new(9, ColorType.Background);
public static readonly Color256 Cyan = new(11, ColorType.Background);
public static readonly Color256 DarkBlue = new(1, ColorType.Background);
public static readonly Color256 DarkCyan = new(3, ColorType.Background);
public static readonly Color256 DarkGray = new(8, ColorType.Background);
public static readonly Color256 DarkGreen = new(2, ColorType.Background);
public static readonly Color256 DarkMagenta = new(5, ColorType.Background);
public static readonly Color256 DarkRed = new(4, ColorType.Background);
public static readonly Color256 DarkYellow = new(6, ColorType.Background);
public static readonly Color256 Gray = new(7, ColorType.Background);
public static readonly Color256 Green = new(10, ColorType.Background);
public static readonly Color256 Magenta = new(13, ColorType.Background);
public static readonly Color256 Red = new(12, ColorType.Background);
public static readonly Color256 White = new(15, ColorType.Background);
}
public static class Foregrounds
{
public static readonly Color256 Black = new(0, ColorType.Foreground);
public static readonly Color256 Blue = new(9, ColorType.Foreground);
public static readonly Color256 Cyan = new(11, ColorType.Foreground);
public static readonly Color256 DarkBlue = new(1, ColorType.Foreground);
public static readonly Color256 DarkCyan = new(3, ColorType.Foreground);
public static readonly Color256 DarkGray = new(8, ColorType.Foreground);
public static readonly Color256 DarkGreen = new(2, ColorType.Foreground);
public static readonly Color256 DarkMagenta = new(5, ColorType.Foreground);
public static readonly Color256 DarkRed = new(4, ColorType.Foreground);
public static readonly Color256 DarkYellow = new(6, ColorType.Foreground);
public static readonly Color256 Gray = new(7, ColorType.Foreground);
public static readonly Color256 Green = new(10, ColorType.Foreground);
public static readonly Color256 Magenta = new(13, ColorType.Foreground);
public static readonly Color256 Red = new(12, ColorType.Foreground);
public static readonly Color256 White = new(15, ColorType.Foreground);
}
}
public static class ConsoleColors
{
public static class Backgrounds
{
public static readonly ConsoleColor Black = new(System.ConsoleColor.Black, ColorType.Background);
public static readonly ConsoleColor Blue = new(System.ConsoleColor.Blue, ColorType.Background);
public static readonly ConsoleColor Cyan = new(System.ConsoleColor.Cyan, ColorType.Background);
public static readonly ConsoleColor DarkBlue = new(System.ConsoleColor.DarkBlue, ColorType.Background);
public static readonly ConsoleColor DarkCyan = new(System.ConsoleColor.DarkCyan, ColorType.Background);
public static readonly ConsoleColor DarkGray = new(System.ConsoleColor.DarkGray, ColorType.Background);
public static readonly ConsoleColor DarkGreen = new(System.ConsoleColor.DarkGreen, ColorType.Background);
public static readonly ConsoleColor DarkMagenta = new(System.ConsoleColor.DarkMagenta, ColorType.Background);
public static readonly ConsoleColor DarkRed = new(System.ConsoleColor.DarkRed, ColorType.Background);
public static readonly ConsoleColor DarkYellow = new(System.ConsoleColor.DarkYellow, ColorType.Background);
public static readonly ConsoleColor Gray = new(System.ConsoleColor.Gray, ColorType.Background);
public static readonly ConsoleColor Green = new(System.ConsoleColor.Green, ColorType.Background);
public static readonly ConsoleColor Magenta = new(System.ConsoleColor.Magenta, ColorType.Background);
public static readonly ConsoleColor Red = new(System.ConsoleColor.Red, ColorType.Background);
public static readonly ConsoleColor White = new(System.ConsoleColor.White, ColorType.Background);
public static readonly ConsoleColor Yellow = new(System.ConsoleColor.Yellow, ColorType.Background);
}
public static class Foregrounds
{
public static readonly ConsoleColor Black = new(System.ConsoleColor.Black, ColorType.Foreground);
public static readonly ConsoleColor Blue = new(System.ConsoleColor.Blue, ColorType.Foreground);
public static readonly ConsoleColor Cyan = new(System.ConsoleColor.Cyan, ColorType.Foreground);
public static readonly ConsoleColor DarkBlue = new(System.ConsoleColor.DarkBlue, ColorType.Foreground);
public static readonly ConsoleColor DarkCyan = new(System.ConsoleColor.DarkCyan, ColorType.Foreground);
public static readonly ConsoleColor DarkGray = new(System.ConsoleColor.DarkGray, ColorType.Foreground);
public static readonly ConsoleColor DarkGreen = new(System.ConsoleColor.DarkGreen, ColorType.Foreground);
public static readonly ConsoleColor DarkMagenta = new(System.ConsoleColor.DarkMagenta, ColorType.Foreground);
public static readonly ConsoleColor DarkRed = new(System.ConsoleColor.DarkRed, ColorType.Foreground);
public static readonly ConsoleColor DarkYellow = new(System.ConsoleColor.DarkYellow, ColorType.Foreground);
public static readonly ConsoleColor Gray = new(System.ConsoleColor.Gray, ColorType.Foreground);
public static readonly ConsoleColor Green = new(System.ConsoleColor.Green, ColorType.Foreground);
public static readonly ConsoleColor Magenta = new(System.ConsoleColor.Magenta, ColorType.Foreground);
public static readonly ConsoleColor Red = new(System.ConsoleColor.Red, ColorType.Foreground);
public static readonly ConsoleColor White = new(System.ConsoleColor.White, ColorType.Foreground);
public static readonly ConsoleColor Yellow = new(System.ConsoleColor.Yellow, ColorType.Foreground);
}
}

View File

@@ -1,6 +0,0 @@
namespace TerminalUI.Models;
public record ConsoleColor(System.ConsoleColor Color, ColorType Type) : IColor
{
public string ToConsoleColor() => throw new NotImplementedException();
}

View File

@@ -1,7 +0,0 @@
namespace TerminalUI.Models;
public interface IColor
{
ColorType Type { get; }
string ToConsoleColor();
}

View File

@@ -1,3 +1,3 @@
namespace TerminalUI.Models;
public record struct Position(int PosX, int PosY);
public record struct Position(int X, int Y);

View File

@@ -0,0 +1,3 @@
namespace TerminalUI.Models;
public record Size(int Width, int Height);