BasicColor fixes
This commit is contained in:
@@ -169,7 +169,7 @@ namespace FileTime.ConsoleUI.App
|
||||
{
|
||||
if (_selectedPane!.CurrentLocation.IsExists(newPath))
|
||||
{
|
||||
_coloredConsoleRenderer.ForegroundColor = AnsiColor.From8bit(1);
|
||||
_coloredConsoleRenderer.ForegroundColor = _styles.ErrorColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace FileTime.ConsoleUI.App
|
||||
private readonly IColoredConsoleRenderer _coloredConsoleRenderer;
|
||||
private readonly CommandExecutor _commandExecutor;
|
||||
private readonly ConsoleReader _consoleReader;
|
||||
private readonly IStyles _styles;
|
||||
private readonly List<ConsoleKeyInfo> _previousKeys = new();
|
||||
|
||||
public bool IsRunning { get; private set; } = true;
|
||||
@@ -34,13 +35,15 @@ namespace FileTime.ConsoleUI.App
|
||||
IClipboard clipboard,
|
||||
IColoredConsoleRenderer coloredConsoleRenderer,
|
||||
CommandExecutor commandExecutor,
|
||||
ConsoleReader consoleReader)
|
||||
ConsoleReader consoleReader,
|
||||
IStyles styles)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
_clipboard = clipboard;
|
||||
_coloredConsoleRenderer = coloredConsoleRenderer;
|
||||
_commandExecutor = commandExecutor;
|
||||
_consoleReader = consoleReader;
|
||||
_styles = styles;
|
||||
InitCommandBindings();
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace FileTime.ConsoleUI.App.UI.Color
|
||||
}
|
||||
else if (BackgroundColor.GetType() != ForegroundColor.GetType())
|
||||
{
|
||||
throw new Exception($"Type of {nameof(BackgroundColor)} and {nameof(ForegroundColor)} must be the same.");
|
||||
throw new Exception($"Type of {nameof(BackgroundColor)} ({BackgroundColor.GetType()}) and {nameof(ForegroundColor)} ({ForegroundColor.GetType()}) must be the same.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -14,5 +14,7 @@ namespace FileTime.ConsoleUI.App.UI
|
||||
IConsoleColor? ElementSpecialForeground { get; }
|
||||
IConsoleColor? SelectedItemBackground { get; }
|
||||
IConsoleColor? SelectedItemForeground { get; }
|
||||
IConsoleColor? ErrorColor { get; }
|
||||
IConsoleColor? AccentForeground { get; }
|
||||
}
|
||||
}
|
||||
@@ -133,13 +133,13 @@ namespace FileTime.ConsoleUI.App.UI
|
||||
{
|
||||
Console.SetCursorPosition(0, 0);
|
||||
_coloredRenderer.ResetColor();
|
||||
_coloredRenderer.ForegroundColor = AnsiColor.From8bit(2);
|
||||
_coloredRenderer.ForegroundColor = _appStyle.AccentForeground;
|
||||
_coloredRenderer.Write(Environment.UserName + "@" + Environment.MachineName);
|
||||
|
||||
_coloredRenderer.ResetColor();
|
||||
_coloredRenderer.Write(' ');
|
||||
|
||||
_coloredRenderer.ForegroundColor = AnsiColor.From8bit(4);
|
||||
_coloredRenderer.ForegroundColor = _appStyle.ContainerForeground;
|
||||
var path = Pane!.CurrentLocation.FullName + "/";
|
||||
_coloredRenderer.Write(path);
|
||||
|
||||
|
||||
@@ -15,6 +15,9 @@ namespace FileTime.ConsoleUI.App.UI
|
||||
public IConsoleColor? SelectedItemBackground { get; }
|
||||
public IConsoleColor? SelectedItemForeground { get; }
|
||||
|
||||
public IConsoleColor? ErrorColor { get; }
|
||||
public IConsoleColor? AccentForeground { get; }
|
||||
|
||||
public Styles(bool useAnsiColors)
|
||||
{
|
||||
if (useAnsiColors)
|
||||
@@ -23,17 +26,25 @@ namespace FileTime.ConsoleUI.App.UI
|
||||
ElementForeground = AnsiColor.From8bit(14);
|
||||
ElementSpecialForeground = AnsiColor.From8bit(2);
|
||||
SelectedItemForeground = AnsiColor.From8bit(3);
|
||||
ElementBackground = AnsiColor.From8bit(0);
|
||||
|
||||
DefaultForeground = ElementForeground;
|
||||
SelectedItemBackground = ElementSpecialBackground = ContainerBackground = DefaultBackground = ElementBackground = AnsiColor.From8bit(0);
|
||||
ErrorColor = AnsiColor.From8bit(1);
|
||||
AccentForeground = AnsiColor.From8bit(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
ContainerBackground = new BasicColor(Console.BackgroundColor);
|
||||
ContainerForeground = new BasicColor(ConsoleColor.Blue);
|
||||
ElementBackground = new BasicColor(Console.BackgroundColor);
|
||||
ElementForeground = new BasicColor(Console.ForegroundColor);
|
||||
ElementSpecialForeground = new BasicColor(ConsoleColor.DarkGreen);
|
||||
SelectedItemForeground = new BasicColor(ConsoleColor.DarkCyan);
|
||||
|
||||
ErrorColor = new BasicColor(ConsoleColor.Red);
|
||||
AccentForeground = new BasicColor(ConsoleColor.Green);
|
||||
}
|
||||
|
||||
DefaultForeground = ElementForeground;
|
||||
SelectedItemBackground = ElementSpecialBackground = ContainerBackground = DefaultBackground = ElementBackground;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user