Skip to content

Commit c22c4ef

Browse files
author
tznind
committed
Make open/save also use obvious color scheme
1 parent ff31075 commit c22c4ef

4 files changed

Lines changed: 26 additions & 2 deletions

File tree

src/UI/Editor.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,8 @@ private void Open()
11371137
{
11381138
Title = "Open",
11391139
AllowedTypes = new List<IAllowedType>(new[] { new AllowedType("View", SourceCodeFile.ExpectedExtension) })
1140-
};
1140+
};
1141+
ofd.SetupNiceColorSchemes();
11411142

11421143
Application.Run(ofd, this.ErrorHandler);
11431144

@@ -1218,6 +1219,7 @@ private void New()
12181219
AllowedTypes = new List<IAllowedType>() { new AllowedType("C# File", ".cs") },
12191220
Path = "MyView.cs",
12201221
};
1222+
ofd.SetupNiceColorSchemes();
12211223

12221224
Application.Run(ofd);
12231225

src/UI/ValueFactory.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ internal static bool GetNewValue(string propertyName, Design design, Type type,
191191
if (type == typeof(FileSystemInfo))
192192
{
193193
var fd = new FileDialog();
194+
fd.SetupNiceColorSchemes();
194195
fd.AllowsMultipleSelection = false;
195196

196197
int answer = ChoicesDialog.Query(propertyName, $"Directory or File?", "Directory", "File", "Cancel");

src/UI/Windows/SizeEditor.Designer.cs

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ViewExtensions.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,4 +497,26 @@ public static bool AnySuperViewIs<T>(this View v) where T : View
497497

498498
return null;
499499
}
500+
501+
public static void SetupNiceColorSchemes(this Dialog v)
502+
{
503+
504+
ColorScheme dialogBackground;
505+
ColorScheme buttons;
506+
dialogBackground = new Terminal.Gui.ColorScheme(new Terminal.Gui.Attribute(4294967295u, 4285953654u), new Terminal.Gui.Attribute(4294967295u, 4285953654u), new Terminal.Gui.Attribute(4294967295u, 4285953654u), new Terminal.Gui.Attribute(4278190080u, 4278190080u), new Terminal.Gui.Attribute(4294967295u, 4285953654u));
507+
buttons = new Terminal.Gui.ColorScheme(new Terminal.Gui.Attribute(4285953654u, 4294967295u), new Terminal.Gui.Attribute(4294901760u, 4294967040u), new Terminal.Gui.Attribute(4278190080u, 4294967295u), new Terminal.Gui.Attribute(4278190080u, 4278190080u), new Terminal.Gui.Attribute(4278190080u, 4294967040u));
508+
509+
v.ColorScheme = dialogBackground;
510+
511+
void ApplyScheme(View view)
512+
{
513+
if (view is Button or TableView)
514+
view.ColorScheme = buttons;
515+
516+
foreach (var subView in view.SubViews)
517+
ApplyScheme(subView);
518+
}
519+
520+
ApplyScheme(v);
521+
}
500522
}

0 commit comments

Comments
 (0)