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