Theme improvements
This commit is contained in:
@@ -8,6 +8,10 @@ public interface ITheme
|
||||
IColor? DefaultBackgroundColor { get; }
|
||||
IColor? ElementColor { get; }
|
||||
IColor? ContainerColor { get; }
|
||||
IColor? MarkedItemColor { get; }
|
||||
IColor? MarkedItemForegroundColor { get; }
|
||||
IColor? MarkedItemBackgroundColor { get; }
|
||||
IColor? MarkedSelectedItemForegroundColor { get; }
|
||||
IColor? MarkedSelectedItemBackgroundColor { get; }
|
||||
IColor? SelectedItemColor { get; }
|
||||
IColor? SelectedTabBackgroundColor { get; }
|
||||
}
|
||||
@@ -45,6 +45,9 @@ public class MainWindow
|
||||
ChildInitializer =
|
||||
{
|
||||
new TextBlock<IAppState>()
|
||||
{
|
||||
Foreground = _theme.ContainerColor
|
||||
}
|
||||
.Setup(t =>
|
||||
t.Bind(
|
||||
t,
|
||||
@@ -88,13 +91,13 @@ public class MainWindow
|
||||
{
|
||||
var textBlock = item.CreateChild<TextBlock<ITabViewModel>>();
|
||||
textBlock.Foreground = _theme.DefaultForegroundColor;
|
||||
|
||||
|
||||
textBlock.Bind(
|
||||
textBlock,
|
||||
dc => dc.TabNumber.ToString(),
|
||||
tb => tb.Text,
|
||||
fallbackValue: "?");
|
||||
|
||||
|
||||
textBlock.Bind(
|
||||
textBlock,
|
||||
dc => dc.IsSelected.Value ? _theme.SelectedTabBackgroundColor : null,
|
||||
@@ -319,10 +322,10 @@ public class MainWindow
|
||||
(ItemViewMode.Alternative, AbsolutePathType.Container) => _theme.ContainerColor,
|
||||
(ItemViewMode.Default, _) => _theme.ElementColor,
|
||||
(ItemViewMode.Alternative, _) => _theme.ElementColor,
|
||||
(ItemViewMode.Selected, _) => ToBackgroundColor(ItemViewMode.Default, absolutePathType)?.AsForeground(),
|
||||
(ItemViewMode.Marked, _) => _theme.MarkedItemColor,
|
||||
(ItemViewMode.MarkedSelected, _) => ToBackgroundColor(ItemViewMode.Marked, absolutePathType)?.AsForeground(),
|
||||
(ItemViewMode.MarkedAlternative, _) => _theme.MarkedItemColor,
|
||||
(ItemViewMode.Selected, _) => _theme.SelectedItemColor,
|
||||
(ItemViewMode.Marked, _) => _theme.MarkedItemForegroundColor,
|
||||
(ItemViewMode.MarkedSelected, _) => _theme.SelectedItemColor,
|
||||
(ItemViewMode.MarkedAlternative, _) => _theme.MarkedItemForegroundColor,
|
||||
_ => throw new NotImplementedException()
|
||||
};
|
||||
|
||||
@@ -332,9 +335,9 @@ public class MainWindow
|
||||
(ItemViewMode.Default, _) => _theme.DefaultBackgroundColor,
|
||||
(ItemViewMode.Alternative, _) => _theme.DefaultBackgroundColor,
|
||||
(ItemViewMode.Selected, _) => ToForegroundColor(ItemViewMode.Default, absolutePathType)?.AsBackground(),
|
||||
(ItemViewMode.Marked, _) => _theme.MarkedItemColor,
|
||||
(ItemViewMode.Marked, _) => _theme.MarkedItemBackgroundColor,
|
||||
(ItemViewMode.MarkedSelected, _) => ToForegroundColor(ItemViewMode.Marked, absolutePathType)?.AsBackground(),
|
||||
(ItemViewMode.MarkedAlternative, _) => _theme.MarkedItemColor,
|
||||
(ItemViewMode.MarkedAlternative, _) => _theme.MarkedItemBackgroundColor,
|
||||
_ => throw new NotImplementedException()
|
||||
};
|
||||
}
|
||||
@@ -8,7 +8,11 @@ public record Theme(
|
||||
IColor? DefaultBackgroundColor,
|
||||
IColor? ElementColor,
|
||||
IColor? ContainerColor,
|
||||
IColor? MarkedItemColor,
|
||||
IColor? MarkedItemForegroundColor,
|
||||
IColor? MarkedItemBackgroundColor,
|
||||
IColor? MarkedSelectedItemForegroundColor,
|
||||
IColor? MarkedSelectedItemBackgroundColor,
|
||||
IColor? SelectedItemColor,
|
||||
IColor? SelectedTabBackgroundColor,
|
||||
Type? ForegroundColors,
|
||||
Type? BackgroundColors) : ITheme, IColorSampleProvider;
|
||||
@@ -20,7 +24,11 @@ public static class DefaultThemes
|
||||
DefaultBackgroundColor: null,
|
||||
ElementColor: Color256Colors.Foregrounds.Gray,
|
||||
ContainerColor: Color256Colors.Foregrounds.Blue,
|
||||
MarkedItemColor: Color256Colors.Foregrounds.Black,
|
||||
MarkedItemForegroundColor: Color256Colors.Foregrounds.Yellow,
|
||||
MarkedItemBackgroundColor: null,
|
||||
MarkedSelectedItemForegroundColor: Color256Colors.Foregrounds.Black,
|
||||
MarkedSelectedItemBackgroundColor: Color256Colors.Foregrounds.Yellow,
|
||||
SelectedItemColor: Color256Colors.Foregrounds.Black,
|
||||
SelectedTabBackgroundColor: Color256Colors.Backgrounds.Green,
|
||||
ForegroundColors: typeof(Color256Colors.Foregrounds),
|
||||
BackgroundColors: typeof(Color256Colors.Backgrounds)
|
||||
@@ -28,10 +36,14 @@ public static class DefaultThemes
|
||||
|
||||
public static Theme ConsoleColorTheme => new(
|
||||
DefaultForegroundColor: ConsoleColors.Foregrounds.Gray,
|
||||
DefaultBackgroundColor: ConsoleColors.Backgrounds.Black,
|
||||
DefaultBackgroundColor: null,
|
||||
ElementColor: ConsoleColors.Foregrounds.Gray,
|
||||
ContainerColor: ConsoleColors.Foregrounds.Blue,
|
||||
MarkedItemColor: ConsoleColors.Foregrounds.Black,
|
||||
MarkedItemForegroundColor: ConsoleColors.Foregrounds.Yellow,
|
||||
MarkedItemBackgroundColor: null,
|
||||
MarkedSelectedItemForegroundColor: ConsoleColors.Foregrounds.Black,
|
||||
MarkedSelectedItemBackgroundColor: ConsoleColors.Foregrounds.Yellow,
|
||||
SelectedItemColor: ConsoleColors.Foregrounds.Black,
|
||||
SelectedTabBackgroundColor: ConsoleColors.Backgrounds.Green,
|
||||
ForegroundColors: typeof(ConsoleColors.Foregrounds),
|
||||
BackgroundColors: typeof(ConsoleColors.Backgrounds)
|
||||
|
||||
@@ -79,7 +79,7 @@ public static class ColorSchema
|
||||
.OrderBy(v => v.Key)
|
||||
.ToDictionary(k => k.Key, v => v.Value);
|
||||
|
||||
consoleDriver.Write("Color theme for " + paletteName + Environment.NewLine);
|
||||
consoleDriver.Write("Color palette for " + paletteName + Environment.NewLine);
|
||||
|
||||
if (colors.Count == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user