فهرست منبع

Fixes #2944. Makes `ColorScheme` explicitly readonly, removes `Colors.Base`, etc..., Fixes intermittent `TreeView` unit test failures (#3175)

* Removed resharper settings from editorconfig

* Moved ColorScheme to ColorScheme.cs

* Moved ColorScheme to ColorScheme.cs

* Potential fix. PlatformColor was not being set by FakeDriver correctly.

* Made ColorScheme effectively readonly

* Removed Color.Base etc... Updated API docs.
Tig 1 سال پیش
والد
کامیت
2c725b877f
81فایلهای تغییر یافته به همراه616 افزوده شده و 565 حذف شده
  1. 1 1
      ReactiveExample/LoginView.cs
  2. 2 0
      Terminal.Gui/Application.cs
  3. 18 6
      Terminal.Gui/Configuration/ColorSchemeJsonConverter.cs
  4. 1 1
      Terminal.Gui/Configuration/ThemeManager.cs
  5. 1 1
      Terminal.Gui/ConsoleDrivers/ConsoleDriver.cs
  6. 5 259
      Terminal.Gui/Drawing/Color.cs
  7. 246 0
      Terminal.Gui/Drawing/ColorScheme.cs
  8. 1 1
      Terminal.Gui/Text/Autocomplete/PopupAutocomplete.cs
  9. 1 1
      Terminal.Gui/View/Adornment/Border.cs
  10. 1 1
      Terminal.Gui/View/Adornment/Margin.cs
  11. 7 2
      Terminal.Gui/View/ViewDrawing.cs
  12. 5 3
      Terminal.Gui/Views/ComboBox.cs
  13. 2 2
      Terminal.Gui/Views/Dialog.cs
  14. 3 1
      Terminal.Gui/Views/FileDialog.cs
  15. 1 1
      Terminal.Gui/Views/Menu/MenuBar.cs
  16. 2 2
      Terminal.Gui/Views/MessageBox.cs
  17. 1 1
      Terminal.Gui/Views/StatusBar.cs
  18. 1 1
      Terminal.Gui/Views/Toplevel.cs
  19. 2 2
      Terminal.Gui/Views/Window.cs
  20. 2 2
      Terminal.Gui/Views/Wizard/Wizard.cs
  21. 0 1
      Terminal.sln
  22. 3 3
      UICatalog/Scenarios/Adornments.cs
  23. 5 5
      UICatalog/Scenarios/AllViewsTester.cs
  24. 1 1
      UICatalog/Scenarios/AutoSizeAndDirectionText.cs
  25. 3 3
      UICatalog/Scenarios/BackgroundWorkerCollection.cs
  26. 3 2
      UICatalog/Scenarios/BasicColors.cs
  27. 7 7
      UICatalog/Scenarios/Buttons.cs
  28. 2 2
      UICatalog/Scenarios/CharacterMap.cs
  29. 6 6
      UICatalog/Scenarios/Clipping.cs
  30. 1 1
      UICatalog/Scenarios/CollectionNavigatorTester.cs
  31. 1 1
      UICatalog/Scenarios/ComboBoxIteration.cs
  32. 13 13
      UICatalog/Scenarios/ComputedLayout.cs
  33. 1 1
      UICatalog/Scenarios/Dialogs.cs
  34. 2 2
      UICatalog/Scenarios/DynamicMenuBar.cs
  35. 1 1
      UICatalog/Scenarios/DynamicStatusBar.cs
  36. 1 1
      UICatalog/Scenarios/Editor.cs
  37. 6 4
      UICatalog/Scenarios/InvertColors.cs
  38. 5 5
      UICatalog/Scenarios/Keys.cs
  39. 7 7
      UICatalog/Scenarios/LabelsAsButtons.cs
  40. 2 2
      UICatalog/Scenarios/LineCanvasExperiment.cs
  41. 1 1
      UICatalog/Scenarios/ListViewWithSelection.cs
  42. 2 2
      UICatalog/Scenarios/ListsAndCombos.cs
  43. 1 1
      UICatalog/Scenarios/MenuBarScenario.cs
  44. 1 1
      UICatalog/Scenarios/MessageBoxes.cs
  45. 1 1
      UICatalog/Scenarios/Mouse.cs
  46. 1 1
      UICatalog/Scenarios/Notepad.cs
  47. 3 3
      UICatalog/Scenarios/Progress.cs
  48. 1 1
      UICatalog/Scenarios/RuneWidthGreaterThanOne.cs
  49. 6 6
      UICatalog/Scenarios/Scrolling.cs
  50. 1 1
      UICatalog/Scenarios/SingleBackgroundWorker.cs
  51. 7 4
      UICatalog/Scenarios/Sliders.cs
  52. 3 3
      UICatalog/Scenarios/TextAlignments.cs
  53. 1 1
      UICatalog/Scenarios/TextAlignmentsAndDirection.cs
  54. 4 4
      UICatalog/Scenarios/TextFormatterDemo.cs
  55. 2 2
      UICatalog/Scenarios/Threading.cs
  56. 4 4
      UICatalog/Scenarios/VkeyPacketSimulator.cs
  57. 14 14
      UICatalog/Scenarios/WindowsAndFrameViews.cs
  58. 3 3
      UICatalog/Scenarios/Wizards.cs
  59. 2 2
      UnitTests/Application/ApplicationTests.cs
  60. 17 17
      UnitTests/Configuration/ConfigurationMangerTests.cs
  61. 8 4
      UnitTests/Configuration/ThemeTests.cs
  62. 43 0
      UnitTests/Drawing/ColorSchemeTests.cs
  63. 0 22
      UnitTests/Drawing/ColorTests.cs
  64. 13 14
      UnitTests/TestHelpers.cs
  65. 2 2
      UnitTests/Text/AutocompleteTests.cs
  66. 5 5
      UnitTests/UICatalog/ScenarioTests.cs
  67. 0 1
      UnitTests/View/Adornment/BorderTests.cs
  68. 9 9
      UnitTests/View/DrawTests.cs
  69. 4 4
      UnitTests/View/Text/AutoSizeTextTests.cs
  70. 7 7
      UnitTests/View/ViewTests.cs
  71. 3 3
      UnitTests/Views/MenuBarTests.cs
  72. 2 2
      UnitTests/Views/OverlappedTests.cs
  73. 1 1
      UnitTests/Views/ProgressBarTests.cs
  74. 5 5
      UnitTests/Views/RuneCellTests.cs
  75. 3 3
      UnitTests/Views/ScrollViewTests.cs
  76. 1 1
      UnitTests/Views/StatusBarTests.cs
  77. 57 49
      UnitTests/Views/TableViewTests.cs
  78. 1 1
      UnitTests/Views/TextFieldTests.cs
  79. 1 1
      UnitTests/Views/TextViewTests.cs
  80. 1 1
      UnitTests/Views/ToplevelTests.cs
  81. 2 2
      UnitTests/Views/TreeTableSourceTests.cs

+ 1 - 1
ReactiveExample/LoginView.cs

@@ -122,7 +122,7 @@ namespace ReactiveExample {
 				.DisposeWith (_disposable);
 			ViewModel
 				.WhenAnyValue (x => x.IsValid)	
-				.Select (valid => valid ? Colors.Base : Colors.Error)
+				.Select (valid => valid ? Colors.ColorSchemes ["Base"] : Colors.ColorSchemes ["Error"])
 				.BindTo (validationLabel, x => x.ColorScheme)
 				.DisposeWith (_disposable);
 			Add (validationLabel);

+ 2 - 0
Terminal.Gui/Application.cs

@@ -96,6 +96,8 @@ public static partial class Application {
 		KeyUp = null;
 		SizeChanging = null;
 
+		Colors.Reset ();
+
 		// Reset synchronization context to allow the user to run async/await,
 		// as the main loop has been ended, the synchronization context from 
 		// gui.cs does no longer process any callbacks. See #1084 for more details:

+ 18 - 6
Terminal.Gui/Configuration/ColorSchemeJsonConverter.cs

@@ -28,10 +28,22 @@ namespace Terminal.Gui {
 				throw new JsonException ($"Unexpected StartObject token when parsing ColorScheme: {reader.TokenType}.");
 			}
 
-			var colorScheme = new ColorScheme ();
+			Attribute normal = Attribute.Default;
+			Attribute focus = Attribute.Default;
+			Attribute hotNormal = Attribute.Default;
+			Attribute hotFocus = Attribute.Default;
+			Attribute disabled = Attribute.Default;
 
 			while (reader.Read ()) {
 				if (reader.TokenType == JsonTokenType.EndObject) {
+					var colorScheme = new ColorScheme () {
+						Normal = normal,
+						Focus = focus,
+						HotNormal = hotNormal,
+						HotFocus = hotFocus,
+						Disabled = disabled
+					};
+
 					return colorScheme;
 				}
 
@@ -45,19 +57,19 @@ namespace Terminal.Gui {
 
 				switch (propertyName.ToLower()) {
 				case "normal":
-					colorScheme.Normal = attribute;
+					normal = attribute;
 					break;
 				case "focus":
-					colorScheme.Focus = attribute;
+					focus = attribute;
 					break;
 				case "hotnormal":
-					colorScheme.HotNormal = attribute;
+					hotNormal = attribute;
 					break;
 				case "hotfocus":
-					colorScheme.HotFocus = attribute;
+					hotFocus = attribute;
 					break;
 				case "disabled":
-					colorScheme.Disabled = attribute;
+					disabled = attribute;
 					break;
 				default:
 					throw new JsonException ($"Unrecognized ColorScheme Attribute name: {propertyName}.");

+ 1 - 1
Terminal.Gui/Configuration/ThemeManager.cs

@@ -133,7 +133,7 @@ public class ThemeManager : IDictionary<string, ThemeScope> {
 	internal static void Reset ()
 	{
 		Debug.WriteLine ($"Themes.Reset()");
-
+		Colors.Reset ();
 		Themes?.Clear ();
 		SelectedTheme = string.Empty;
 	}

+ 1 - 1
Terminal.Gui/ConsoleDrivers/ConsoleDriver.cs

@@ -467,7 +467,7 @@ public abstract class ConsoleDriver {
 	public virtual Attribute MakeColor (Color foreground, Color background) =>
 		// Encode the colors into the int value.
 		new (
-			0, // only used by cursesdriver!
+			-1, // only used by cursesdriver!
 			foreground,
 			background
 		);

+ 5 - 259
Terminal.Gui/Drawing/Color.cs

@@ -4,7 +4,6 @@ using System.Collections.Generic;
 using System.Collections.Immutable;
 using System.Diagnostics.CodeAnalysis;
 using System.Linq;
-using System.Runtime.CompilerServices;
 using System.Text.Json.Serialization;
 using System.Text.RegularExpressions;
 
@@ -634,24 +633,23 @@ public readonly struct Color : IEquatable<Color> {
 	public static implicit operator Color (int rgba) => new (rgba);
 
 	/// <summary>
-	/// Cast to int.
+	/// Cast to int. 
 	/// </summary>
 	/// <param name="color"></param>
-	public static explicit operator int (Color color) => color.Rgba;
+	public static implicit operator int (Color color) => color.Rgba;
 
 	/// <summary>
-	/// Cast from <see cref="Gui.ColorName"/>.
+	/// Cast from <see cref="Gui.ColorName"/>. May fail if the color is not a named color.
 	/// </summary>
 	/// <param name="colorName"></param>
 	public static explicit operator Color (ColorName colorName) => new (colorName);
 
 	/// <summary>
-	/// Cast to <see cref="Gui.ColorName"/>.
+	/// Cast to <see cref="Gui.ColorName"/>. May fail if the color is not a named color.
 	/// </summary>
 	/// <param name="color"></param>
 	public static explicit operator ColorName (Color color) => color.ColorName;
 
-
 	/// <summary>
 	/// Equality operator for two <see cref="Color"/> objects..
 	/// </summary>
@@ -660,7 +658,6 @@ public readonly struct Color : IEquatable<Color> {
 	/// <returns></returns>
 	public static bool operator == (Color left, Color right) => left.Equals (right);
 
-
 	/// <summary>
 	/// Inequality operator for two <see cref="Color"/> objects.
 	/// </summary>
@@ -888,257 +885,6 @@ public readonly struct Attribute : IEquatable<Attribute> {
 
 	/// <inheritdoc/>
 	public override string ToString () =>
-		// Note, Unit tests are dependent on this format
+		// Note: Unit tests are dependent on this format
 		$"[{Foreground},{Background}]";
 }
-
-/// <summary>
-/// Defines the <see cref="Attribute"/>s for common visible elements in a <see cref="View"/>.
-/// Containers such as <see cref="Window"/> and <see cref="FrameView"/> use <see cref="ColorScheme"/> to determine
-/// the colors used by sub-views.
-/// </summary>
-/// <remarks>
-/// See also: <see cref="Colors.ColorSchemes"/>.
-/// </remarks>
-[JsonConverter (typeof (ColorSchemeJsonConverter))]
-public class ColorScheme : IEquatable<ColorScheme> {
-	Attribute _disabled = Attribute.Default;
-	Attribute _focus = Attribute.Default;
-	Attribute _hotFocus = Attribute.Default;
-	Attribute _hotNormal = Attribute.Default;
-	Attribute _normal = Attribute.Default;
-
-	/// <summary>
-	/// Used by <see cref="Colors.SetColorScheme(ColorScheme, string)"/> and <see cref="Colors.GetColorScheme(string)"/> to
-	/// track which ColorScheme
-	/// is being accessed.
-	/// </summary>
-	internal string _schemeBeingSet = "";
-
-	/// <summary>
-	/// Creates a new instance.
-	/// </summary>
-	public ColorScheme () : this (Attribute.Default) { }
-
-	/// <summary>
-	/// Creates a new instance, initialized with the values from <paramref name="scheme"/>.
-	/// </summary>
-	/// <param name="scheme">The scheme to initialize the new instance with.</param>
-	public ColorScheme (ColorScheme scheme)
-	{
-		if (scheme != null) {
-			_normal = scheme.Normal;
-			_focus = scheme.Focus;
-			_hotNormal = scheme.HotNormal;
-			_disabled = scheme.Disabled;
-			_hotFocus = scheme.HotFocus;
-		}
-	}
-
-	/// <summary>
-	/// Creates a new instance, initialized with the values from <paramref name="attribute"/>.
-	/// </summary>
-	/// <param name="attribute">The attribute to initialize the new instance with.</param>
-	public ColorScheme (Attribute attribute)
-	{
-		_normal = attribute;
-		_focus = attribute;
-		_hotNormal = attribute;
-		_disabled = attribute;
-		_hotFocus = attribute;
-	}
-
-	/// <summary>
-	/// The foreground and background color for text when the view is not focused, hot, or disabled.
-	/// </summary>
-	public Attribute Normal {
-		get => _normal;
-		set => _normal = value;
-	}
-
-	/// <summary>
-	/// The foreground and background color for text when the view has the focus.
-	/// </summary>
-	public Attribute Focus {
-		get => _focus;
-		set => _focus = value;
-	}
-
-	/// <summary>
-	/// The foreground and background color for text in a non-focused view that indicates a <see cref="View.HotKey"/>.
-	/// </summary>
-	public Attribute HotNormal {
-		get => _hotNormal;
-		set => _hotNormal = value;
-	}
-
-	/// <summary>
-	/// The foreground and background color for for text in a focused view that indicates a <see cref="View.HotKey"/>.
-	/// </summary>
-	public Attribute HotFocus {
-		get => _hotFocus;
-		set => _hotFocus = value;
-	}
-
-	/// <summary>
-	/// The default foreground and background color for text when the view is disabled.
-	/// </summary>
-	public Attribute Disabled {
-		get => _disabled;
-		set => _disabled = value;
-	}
-
-	/// <summary>
-	/// Compares two <see cref="ColorScheme"/> objects for equality.
-	/// </summary>
-	/// <param name="other"></param>
-	/// <returns>true if the two objects are equal</returns>
-	public bool Equals (ColorScheme other) => other != null &&
-	                                          EqualityComparer<Attribute>.Default.Equals (_normal, other._normal) &&
-	                                          EqualityComparer<Attribute>.Default.Equals (_focus, other._focus) &&
-	                                          EqualityComparer<Attribute>.Default.Equals (_hotNormal, other._hotNormal) &&
-	                                          EqualityComparer<Attribute>.Default.Equals (_hotFocus, other._hotFocus) &&
-	                                          EqualityComparer<Attribute>.Default.Equals (_disabled, other._disabled);
-
-	/// <summary>
-	/// Compares two <see cref="ColorScheme"/> objects for equality.
-	/// </summary>
-	/// <param name="obj"></param>
-	/// <returns>true if the two objects are equal</returns>
-	public override bool Equals (object obj) => Equals (obj as ColorScheme);
-
-	/// <summary>
-	/// Returns a hashcode for this instance.
-	/// </summary>
-	/// <returns>hashcode for this instance</returns>
-	public override int GetHashCode ()
-	{
-		var hashCode = -1242460230;
-		hashCode = hashCode * -1521134295 + _normal.GetHashCode ();
-		hashCode = hashCode * -1521134295 + _focus.GetHashCode ();
-		hashCode = hashCode * -1521134295 + _hotNormal.GetHashCode ();
-		hashCode = hashCode * -1521134295 + _hotFocus.GetHashCode ();
-		hashCode = hashCode * -1521134295 + _disabled.GetHashCode ();
-		return hashCode;
-	}
-
-	/// <summary>
-	/// Compares two <see cref="ColorScheme"/> objects for equality.
-	/// </summary>
-	/// <param name="left"></param>
-	/// <param name="right"></param>
-	/// <returns><c>true</c> if the two objects are equivalent</returns>
-	public static bool operator == (ColorScheme left, ColorScheme right) => EqualityComparer<ColorScheme>.Default.Equals (left, right);
-
-	/// <summary>
-	/// Compares two <see cref="ColorScheme"/> objects for inequality.
-	/// </summary>
-	/// <param name="left"></param>
-	/// <param name="right"></param>
-	/// <returns><c>true</c> if the two objects are not equivalent</returns>
-	public static bool operator != (ColorScheme left, ColorScheme right) => !(left == right);
-}
-
-/// <summary>
-/// The default <see cref="ColorScheme"/>s for the application.
-/// </summary>
-/// <remarks>
-/// This property can be set in a Theme to change the default <see cref="Colors"/> for the application.
-/// </remarks>
-public static class Colors {
-
-	static Colors () => ColorSchemes = Create ();
-
-	/// <summary>
-	/// The application Toplevel color scheme, for the default Toplevel views.
-	/// </summary>
-	/// <remarks>
-	///         <para>
-	///         This API will be deprecated in the future. Use <see cref="Colors.ColorSchemes"/> instead (e.g.
-	///         <c>edit.ColorScheme = Colors.ColorSchemes["TopLevel"];</c>
-	///         </para>
-	/// </remarks>
-	public static ColorScheme TopLevel { get => GetColorScheme (); set => SetColorScheme (value); }
-
-	/// <summary>
-	/// The base color scheme, for the default Toplevel views.
-	/// </summary>
-	/// <remarks>
-	///         <para>
-	///         This API will be deprecated in the future. Use <see cref="Colors.ColorSchemes"/> instead (e.g.
-	///         <c>edit.ColorScheme = Colors.ColorSchemes["Base"];</c>
-	///         </para>
-	/// </remarks>
-	public static ColorScheme Base { get => GetColorScheme (); set => SetColorScheme (value); }
-
-	/// <summary>
-	/// The dialog color scheme, for standard popup dialog boxes
-	/// </summary>
-	/// <remarks>
-	///         <para>
-	///         This API will be deprecated in the future. Use <see cref="Colors.ColorSchemes"/> instead (e.g.
-	///         <c>edit.ColorScheme = Colors.ColorSchemes["Dialog"];</c>
-	///         </para>
-	/// </remarks>
-	public static ColorScheme Dialog { get => GetColorScheme (); set => SetColorScheme (value); }
-
-	/// <summary>
-	/// The menu bar color
-	/// </summary>
-	/// <remarks>
-	///         <para>
-	///         This API will be deprecated in the future. Use <see cref="Colors.ColorSchemes"/> instead (e.g.
-	///         <c>edit.ColorScheme = Colors.ColorSchemes["Menu"];</c>
-	///         </para>
-	/// </remarks>
-	public static ColorScheme Menu { get => GetColorScheme (); set => SetColorScheme (value); }
-
-	/// <summary>
-	/// The color scheme for showing errors.
-	/// </summary>
-	/// <remarks>
-	///         <para>
-	///         This API will be deprecated in the future. Use <see cref="Colors.ColorSchemes"/> instead (e.g.
-	///         <c>edit.ColorScheme = Colors.ColorSchemes["Error"];</c>
-	///         </para>
-	/// </remarks>
-	public static ColorScheme Error { get => GetColorScheme (); set => SetColorScheme (value); }
-
-	/// <summary>
-	/// Provides the defined <see cref="ColorScheme"/>s.
-	/// </summary>
-	[SerializableConfigurationProperty (Scope = typeof (ThemeScope), OmitClassName = true)]
-	[JsonConverter (typeof (DictionaryJsonConverter<ColorScheme>))]
-	public static Dictionary<string, ColorScheme> ColorSchemes { get; private set; } // Serialization requires this to have a setter (private set;)
-
-	/// <summary>
-	/// Creates a new dictionary of new <see cref="ColorScheme"/> objects.
-	/// </summary>
-	public static Dictionary<string, ColorScheme> Create () =>
-		// Use reflection to dynamically create the default set of ColorSchemes from the list defined 
-		// by the class. 
-		typeof (Colors).GetProperties ()
-			.Where (p => p.PropertyType == typeof (ColorScheme))
-			.Select (p => new KeyValuePair<string, ColorScheme> (p.Name, new ColorScheme ()))
-			.ToDictionary (t => t.Key, t => t.Value, new SchemeNameComparerIgnoreCase ());
-
-	static ColorScheme GetColorScheme ([CallerMemberName] string schemeBeingSet = null) => ColorSchemes [schemeBeingSet];
-
-	static void SetColorScheme (ColorScheme colorScheme, [CallerMemberName] string schemeBeingSet = null)
-	{
-		ColorSchemes [schemeBeingSet] = colorScheme;
-		colorScheme._schemeBeingSet = schemeBeingSet;
-	}
-
-	class SchemeNameComparerIgnoreCase : IEqualityComparer<string> {
-		public bool Equals (string x, string y)
-		{
-			if (x != null && y != null) {
-				return string.Equals (x, y, StringComparison.InvariantCultureIgnoreCase);
-			}
-			return false;
-		}
-
-		public int GetHashCode (string obj) => obj.ToLowerInvariant ().GetHashCode ();
-	}
-}

+ 246 - 0
Terminal.Gui/Drawing/ColorScheme.cs

@@ -0,0 +1,246 @@
+using System;
+using System.Collections.Generic;
+using System.Text.Json.Serialization;
+
+namespace Terminal.Gui;
+
+/// <summary>
+/// Defines a standard set of <see cref="Attribute"/>s for common visible elements in a <see cref="View"/>.
+/// </summary>
+/// <remarks>
+/// <para>
+/// ColorScheme objects are immutable. Once constructed, the properties cannot be changed.
+/// To change a ColorScheme, create a new one with the desired values,
+/// using the <see cref="ColorScheme(ColorScheme)"/> constructor.
+/// </para>
+/// <para>
+/// See also: <see cref="Colors.ColorSchemes"/>.
+/// </para>
+/// </remarks>
+[JsonConverter (typeof (ColorSchemeJsonConverter))]
+public class ColorScheme : IEquatable<ColorScheme> {
+	readonly Attribute _disabled = Attribute.Default;
+	readonly Attribute _focus = Attribute.Default;
+	readonly Attribute _hotFocus = Attribute.Default;
+	readonly Attribute _hotNormal = Attribute.Default;
+	readonly Attribute _normal = Attribute.Default;
+
+	/// <summary>
+	/// Creates a new instance set to the default colors (see <see cref="Attribute.Default"/>).
+	/// </summary>
+	public ColorScheme () : this (Attribute.Default) { }
+
+	/// <summary>
+	/// Creates a new instance, initialized with the values from <paramref name="scheme"/>.
+	/// </summary>
+	/// <param name="scheme">The scheme to initialize the new instance with.</param>
+	public ColorScheme (ColorScheme scheme)
+	{
+		if (scheme == null) {
+			throw new ArgumentNullException (nameof (scheme));
+		}
+		_normal = scheme.Normal;
+		_focus = scheme.Focus;
+		_hotNormal = scheme.HotNormal;
+		_disabled = scheme.Disabled;
+		_hotFocus = scheme.HotFocus;
+	}
+
+	/// <summary>
+	/// Creates a new instance, initialized with the values from <paramref name="attribute"/>.
+	/// </summary>
+	/// <param name="attribute">The attribute to initialize the new instance with.</param>
+	public ColorScheme (Attribute attribute)
+	{
+		_normal = attribute;
+		_focus = attribute;
+		_hotNormal = attribute;
+		_disabled = attribute;
+		_hotFocus = attribute;
+	}
+
+	/// <summary>
+	/// The foreground and background color for text when the view is not focused, hot, or disabled.
+	/// </summary>
+	public Attribute Normal {
+		get => _normal;
+		init => _normal = value;
+	}
+
+	/// <summary>
+	/// The foreground and background color for text when the view has the focus.
+	/// </summary>
+	public Attribute Focus {
+		get => _focus;
+		init => _focus = value;
+	}
+
+	/// <summary>
+	/// The foreground and background color for text in a non-focused view that indicates a <see cref="View.HotKey"/>.
+	/// </summary>
+	public Attribute HotNormal {
+		get => _hotNormal;
+		init => _hotNormal = value;
+	}
+
+	/// <summary>
+	/// The foreground and background color for for text in a focused view that indicates a <see cref="View.HotKey"/>.
+	/// </summary>
+	public Attribute HotFocus {
+		get => _hotFocus;
+		init => _hotFocus = value;
+	}
+
+	/// <summary>
+	/// The default foreground and background color for text when the view is disabled.
+	/// </summary>
+	public Attribute Disabled {
+		get => _disabled;
+		init => _disabled = value;
+	}
+
+	/// <summary>
+	/// Compares two <see cref="ColorScheme"/> objects for equality.
+	/// </summary>
+	/// <param name="other"></param>
+	/// <returns>true if the two objects are equal</returns>
+	public bool Equals (ColorScheme other) => other != null &&
+	                                          EqualityComparer<Attribute>.Default.Equals (_normal, other._normal) &&
+	                                          EqualityComparer<Attribute>.Default.Equals (_focus, other._focus) &&
+	                                          EqualityComparer<Attribute>.Default.Equals (_hotNormal, other._hotNormal) &&
+	                                          EqualityComparer<Attribute>.Default.Equals (_hotFocus, other._hotFocus) &&
+	                                          EqualityComparer<Attribute>.Default.Equals (_disabled, other._disabled);
+
+	/// <summary>
+	/// Compares two <see cref="ColorScheme"/> objects for equality.
+	/// </summary>
+	/// <param name="obj"></param>
+	/// <returns>true if the two objects are equal</returns>
+	public override bool Equals (object obj) => Equals (obj is ColorScheme ? (ColorScheme)obj : default);
+
+	/// <summary>
+	/// Returns a hashcode for this instance.
+	/// </summary>
+	/// <returns>hashcode for this instance</returns>
+	public override int GetHashCode ()
+	{
+		var hashCode = -1242460230;
+		hashCode = hashCode * -1521134295 + _normal.GetHashCode ();
+		hashCode = hashCode * -1521134295 + _focus.GetHashCode ();
+		hashCode = hashCode * -1521134295 + _hotNormal.GetHashCode ();
+		hashCode = hashCode * -1521134295 + _hotFocus.GetHashCode ();
+		hashCode = hashCode * -1521134295 + _disabled.GetHashCode ();
+		return hashCode;
+	}
+
+	/// <summary>
+	/// Compares two <see cref="ColorScheme"/> objects for equality.
+	/// </summary>
+	/// <param name="left"></param>
+	/// <param name="right"></param>
+	/// <returns><c>true</c> if the two objects are equivalent</returns>
+	public static bool operator == (ColorScheme left, ColorScheme right) => EqualityComparer<ColorScheme>.Default.Equals (left, right);
+
+	/// <summary>
+	/// Compares two <see cref="ColorScheme"/> objects for inequality.
+	/// </summary>
+	/// <param name="left"></param>
+	/// <param name="right"></param>
+	/// <returns><c>true</c> if the two objects are not equivalent</returns>
+	public static bool operator != (ColorScheme left, ColorScheme right) => !(left == right);
+}
+
+/// <summary>
+/// Holds the <see cref="ColorScheme"/>s that define the <see cref="Attribute"/>s that are used by views to render themselves.
+/// </summary>
+public static class Colors {
+	static Colors () => Reset ();
+	/// <summary>
+	/// Gets a dictionary of defined <see cref="ColorScheme"/> objects.
+	/// </summary>
+	/// <remarks>
+	/// <para>
+	/// The <see cref="ColorSchemes"/> dictionary includes the following keys, by default:
+	/// <list type="table">
+	/// <listheader>
+	///         <term>Built-in Color Scheme</term>
+	///         <description>Description</description>
+	/// </listheader>
+	/// <item>
+	///         <term>
+	///         Base
+	///         </term>
+	///         <description>
+	///         The base color scheme used for most Views.
+	///         </description>
+	/// </item>
+	/// <item>
+	///         <term>
+	///         TopLevel
+	///         </term>
+	///         <description>
+	///         The application Toplevel color scheme; used for the <see cref="Toplevel"/> View.
+	///         </description>
+	/// </item>
+	/// <item>
+	///         <term>
+	///         Dialog
+	///         </term>
+	///         <description>
+	///         The dialog color scheme; used for <see cref="Dialog"/>, <see cref="MessageBox"/>, and other views dialog-like views.
+	///         </description>
+	/// </item> 
+	/// <item>
+	///         <term>
+	///         Menu
+	///         </term>
+	///         <description>
+	///         The menu color scheme; used for <see cref="MenuBar"/>, <see cref="ContextMenu"/>, and <see cref="StatusBar"/>. 
+	///         </description>
+	/// </item>
+	/// <item>
+	///         <term>
+	///         Error
+	///         </term>
+	///         <description>
+	///         The color scheme for showing errors, such as in <see cref="MessageBox.ErrorQuery(string, string, string[])"/>. 
+	///         </description>
+	/// </item>
+	/// </list>
+	/// </para>
+	/// <para>
+	/// Changing the values of an entry in this dictionary will affect all views that use the scheme.
+	/// </para>
+	/// <para>
+	/// <see cref="ConfigurationManager"/> can be used to override the default values for these schemes and add additional schemes.
+	/// See <see cref="ConfigurationManager.Themes"/>.
+	/// </para>
+	/// </remarks>
+	[SerializableConfigurationProperty (Scope = typeof (ThemeScope), OmitClassName = true)]
+	[JsonConverter (typeof (DictionaryJsonConverter<ColorScheme>))]
+	public static Dictionary<string, ColorScheme> ColorSchemes { get; private set; } // Serialization requires this to have a setter (private set;)
+
+	/// <summary>
+	/// Resets the <see cref="ColorSchemes"/> dictionary to the default values.
+	/// </summary>
+	public static Dictionary<string, ColorScheme> Reset () =>
+		ColorSchemes = new Dictionary<string, ColorScheme> (comparer: new SchemeNameComparerIgnoreCase ()) {
+			{ "TopLevel", new ColorScheme () },
+			{ "Base", new ColorScheme () },
+			{ "Dialog", new ColorScheme () },
+			{ "Menu", new ColorScheme () },
+			{ "Error", new ColorScheme () },
+		};
+
+	class SchemeNameComparerIgnoreCase : IEqualityComparer<string> {
+		public bool Equals (string x, string y)
+		{
+			if (x != null && y != null) {
+				return string.Equals (x, y, StringComparison.InvariantCultureIgnoreCase);
+			}
+			return false;
+		}
+
+		public int GetHashCode (string obj) => obj.ToLowerInvariant ().GetHashCode ();
+	}
+}

+ 1 - 1
Terminal.Gui/Text/Autocomplete/PopupAutocomplete.cs

@@ -124,7 +124,7 @@ namespace Terminal.Gui {
 		public override ColorScheme ColorScheme {
 			get {
 				if (colorScheme == null) {
-					colorScheme = Colors.Menu;
+					colorScheme = Colors.ColorSchemes ["Menu"];
 				}
 				return colorScheme;
 			}

+ 1 - 1
Terminal.Gui/View/Adornment/Border.cs

@@ -99,7 +99,7 @@ public class Border : Adornment {
 			return;
 		}
 
-		//Driver.SetAttribute (Colors.Error.Normal);
+		//Driver.SetAttribute (Colors.ColorSchemes ["Error"].Normal);
 		var screenBounds = BoundsToScreen (Frame);
 
 		//OnDrawSubviews (bounds); 

+ 1 - 1
Terminal.Gui/View/Adornment/Margin.cs

@@ -27,7 +27,7 @@ public class Margin : Adornment {
 			if (base.ColorScheme != null) {
 				return base.ColorScheme;
 			}
-			return Parent?.SuperView?.ColorScheme ?? Colors.TopLevel;
+			return Parent?.SuperView?.ColorScheme ?? Colors.ColorSchemes ["TopLevel"];
 		}
 		set {
 			base.ColorScheme = value;

+ 7 - 2
Terminal.Gui/View/ViewDrawing.cs

@@ -274,6 +274,9 @@ public partial class View {
 	/// </remarks>
 	public Rect ClipToBounds ()
 	{
+		if (Driver == null) {
+			return Rect.Empty;
+		}
 		var previous = Driver.Clip;
 		Driver.Clip = Rect.Intersect (previous, BoundsToScreen (Bounds));
 		return previous;
@@ -392,7 +395,7 @@ public partial class View {
 
 		if (ColorScheme != null) {
 			//Driver.SetAttribute (HasFocus ? GetFocusColor () : GetNormalColor ());
-			Driver.SetAttribute (GetNormalColor ());
+			Driver?.SetAttribute (GetNormalColor ());
 		}
 
 		// Invoke DrawContentEvent
@@ -403,7 +406,9 @@ public partial class View {
 			OnDrawContent (Bounds);
 		}
 
-		Driver.Clip = prevClip;
+		if (Driver != null) {
+			Driver.Clip = prevClip;
+		}
 
 		OnRenderLineCanvas ();
 		// Invoke DrawContentCompleteEvent

+ 5 - 3
Terminal.Gui/Views/ComboBox.cs

@@ -255,7 +255,7 @@ public class ComboBox : View {
 	public ComboBox (Rect rect, IList source) : base (rect)
 	{
 		_search = new TextField ("") { Width = rect.Width };
-		_listview = new ComboListView (this, rect, source, HideDropdownListOnClick) { ColorScheme = Colors.Base };
+		_listview = new ComboListView (this, rect, source, HideDropdownListOnClick) { ColorScheme = Colors.ColorSchemes ["Base"] };
 
 		SetInitialProperties ();
 		SetSource (source);
@@ -268,7 +268,7 @@ public class ComboBox : View {
 	public ComboBox (IList source) : this (string.Empty)
 	{
 		_search = new TextField ("");
-		_listview = new ComboListView (this, source, HideDropdownListOnClick) { ColorScheme = Colors.Base };
+		_listview = new ComboListView (this, source, HideDropdownListOnClick) { ColorScheme = Colors.ColorSchemes ["Base"] };
 
 		SetInitialProperties ();
 		SetSource (source);
@@ -396,7 +396,9 @@ public class ComboBox : View {
 			_search.ReadOnly = value;
 			if (_search.ReadOnly) {
 				if (_search.ColorScheme != null) {
-					_search.ColorScheme.Normal = _search.ColorScheme.Focus;
+					_search.ColorScheme = new ColorScheme (_search.ColorScheme) {
+						Normal = _search.ColorScheme.Focus
+					};
 				}
 			}
 		}

+ 2 - 2
Terminal.Gui/Views/Dialog.cs

@@ -7,7 +7,7 @@ namespace Terminal.Gui;
 
 /// <summary>
 /// The <see cref="Dialog"/> <see cref="View"/> is a <see cref="Window"/> that by default is centered and contains one 
-/// or more <see cref="Button"/>s. It defaults to the <see cref="Colors.Dialog"/> color scheme and has a 1 cell padding around the edges.
+/// or more <see cref="Button"/>s. It defaults to the <see cref="Colors.ColorSchemes ["Dialog"]"/> color scheme and has a 1 cell padding around the edges.
 /// </summary>
 /// <remarks>
 ///  To run the <see cref="Dialog"/> modally, create the <see cref="Dialog"/>, and pass it to <see cref="Application.Run(Func{Exception, bool})"/>. 
@@ -65,7 +65,7 @@ public class Dialog : Window {
 		Width = Dim.Percent (85);// Dim.Auto (min: Dim.Percent (10));
 		Height = Dim.Percent (85);//Dim.Auto (min: Dim.Percent (50));
 
-		ColorScheme = Colors.Dialog;
+		ColorScheme = Colors.ColorSchemes ["Dialog"];
 
 		Modal = true;
 		ButtonAlignment = DefaultButtonAlignment;

+ 3 - 1
Terminal.Gui/Views/FileDialog.cs

@@ -657,7 +657,9 @@ public class FileDialog : Dialog {
 		tbPath.Caption = Style.PathCaption;
 		tbFind.Caption = Style.SearchCaption;
 
-		tbPath.Autocomplete.ColorScheme.Normal = new Attribute (Color.Black, tbPath.ColorScheme.Normal.Background);
+		tbPath.Autocomplete.ColorScheme = new ColorScheme (tbPath.ColorScheme) {
+			Normal = new Attribute (Color.Black, tbPath.ColorScheme.Normal.Background)
+		};
 
 		_treeRoots = Style.TreeRootGetter ();
 		Style.IconProvider.IsOpenGetter = treeView.IsExpanded;

+ 1 - 1
Terminal.Gui/Views/Menu/MenuBar.cs

@@ -278,7 +278,7 @@ public class MenuBar : View {
 		//CanFocus = true;
 		_selected = -1;
 		_selectedSub = -1;
-		ColorScheme = Colors.Menu;
+		ColorScheme = Colors.ColorSchemes ["Menu"];
 		WantMousePositionReports = true;
 		IsMenuOpen = false;
 

+ 2 - 2
Terminal.Gui/Views/MessageBox.cs

@@ -278,9 +278,9 @@ namespace Terminal.Gui {
 			}
 
 			if (useErrorColors) {
-				d.ColorScheme = Colors.Error;
+				d.ColorScheme = Colors.ColorSchemes ["Error"];
 			} else {
-				d.ColorScheme = Colors.Dialog;
+				d.ColorScheme = Colors.ColorSchemes ["Dialog"];
 			}
 
 			var messageLabel = new Label () {

+ 1 - 1
Terminal.Gui/Views/StatusBar.cs

@@ -111,7 +111,7 @@ public class StatusBar : View {
 			Items = items;
 		}
 		CanFocus = false;
-		ColorScheme = Colors.Menu;
+		ColorScheme = Colors.ColorSchemes ["Menu"];
 		X = 0;
 		Y = Pos.AnchorEnd (1);
 		Width = Dim.Fill ();

+ 1 - 1
Terminal.Gui/Views/Toplevel.cs

@@ -251,7 +251,7 @@ public partial class Toplevel : View {
 
 	void SetInitialProperties ()
 	{
-		ColorScheme = Colors.TopLevel;
+		ColorScheme = Colors.ColorSchemes ["TopLevel"];
 
 		Application.GrabbingMouse += Application_GrabbingMouse;
 		Application.UnGrabbingMouse += Application_UnGrabbingMouse;

+ 2 - 2
Terminal.Gui/Views/Window.cs

@@ -34,7 +34,7 @@ public class Window : Toplevel {
 	///// This property can be set in a Theme to change the default <see cref="LineStyle"/> for all <see cref="Window"/>s. 
 	///// </remarks>
 	/////[SerializableConfigurationProperty (Scope = typeof (ThemeScope)), JsonConverter (typeof (JsonStringEnumConverter))]
-	////public static ColorScheme DefaultColorScheme { get; set; } = Colors.Base;
+	////public static ColorScheme DefaultColorScheme { get; set; } = Colors.ColorSchemes ["Base"];
 
 	/// <summary>
 	/// The default <see cref="LineStyle"/> for <see cref="Window"/>'s border. The default is
@@ -51,7 +51,7 @@ public class Window : Toplevel {
 	void SetInitialProperties ()
 	{
 		CanFocus = true;
-		ColorScheme = Colors.Base; // TODO: make this a theme property
+		ColorScheme = Colors.ColorSchemes ["Base"]; // TODO: make this a theme property
 		BorderStyle = DefaultBorderStyle;
 
 		// This enables the default button to be activated by the Enter key.

+ 2 - 2
Terminal.Gui/Views/Wizard/Wizard.cs

@@ -512,13 +512,13 @@ public class Wizard : Dialog {
 				SizeStep (step);
 			}
 			if (base.Modal) {
-				ColorScheme = Colors.Dialog;
+				ColorScheme = Colors.ColorSchemes ["Dialog"];
 				BorderStyle = LineStyle.Rounded;
 			} else {
 				if (SuperView != null) {
 					ColorScheme = SuperView.ColorScheme;
 				} else {
-					ColorScheme = Colors.Base;
+					ColorScheme = Colors.ColorSchemes ["Base"];
 				}
 				CanFocus = true;
 				BorderStyle = LineStyle.None;

+ 0 - 1
Terminal.sln

@@ -26,7 +26,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
 		nuget.config = nuget.config
 		.github\workflows\publish.yml = .github\workflows\publish.yml
 		README.md = README.md
-		Terminal.Gui\.vscode\settings.json = Terminal.Gui\.vscode\settings.json
 		Terminal.sln.DotSettings = Terminal.sln.DotSettings
 		testenvironments.json = testenvironments.json
 	EndProjectSection

+ 3 - 3
UICatalog/Scenarios/Adornments.cs

@@ -77,9 +77,9 @@ public class Adornments : Scenario {
 		editor.Initialized += (s, e) => {
 			editor.ViewToEdit = view;
 		};
-		//view.Margin.ColorScheme = new ColorScheme (Colors.Dialog);
-		//view.Border.ColorScheme = new ColorScheme (Colors.Error);
-		//view.Padding.ColorScheme = new ColorScheme (Colors.Menu);
+		//view.Margin.ColorScheme = new ColorScheme (Colors.ColorSchemes ["Dialog"]);
+		//view.Border.ColorScheme = new ColorScheme (Colors.ColorSchemes ["Error"]);
+		//view.Padding.ColorScheme = new ColorScheme (Colors.ColorSchemes ["Menu"]);
 
 		Application.Run (editor);
 		Application.Shutdown ();

+ 5 - 5
UICatalog/Scenarios/AllViewsTester.cs

@@ -72,7 +72,7 @@ public class AllViewsTester : Scenario {
 			Width = 15,
 			Height = Dim.Fill (1), // for status bar
 			CanFocus = false,
-			ColorScheme = Colors.TopLevel
+			ColorScheme = Colors.ColorSchemes ["TopLevel"]
 		};
 
 		_classListView = new ListView (_viewClasses.Keys.ToList ()) {
@@ -81,7 +81,7 @@ public class AllViewsTester : Scenario {
 			Width = Dim.Fill (0),
 			Height = Dim.Fill (0),
 			AllowsMarking = false,
-			ColorScheme = Colors.TopLevel,
+			ColorScheme = Colors.ColorSchemes ["TopLevel"],
 			SelectedItem = 0
 		};
 		_classListView.OpenSelectedItem += (s, a) => {
@@ -106,7 +106,7 @@ public class AllViewsTester : Scenario {
 			Width = Dim.Fill (),
 			Height = 10,
 			CanFocus = false,
-			ColorScheme = Colors.TopLevel
+			ColorScheme = Colors.ColorSchemes ["TopLevel"]
 		};
 		_computedCheckBox = new CheckBox ("Computed Layout", true) { X = 0, Y = 0 };
 		_computedCheckBox.Toggled += (s, e) => {
@@ -228,7 +228,7 @@ public class AllViewsTester : Scenario {
 			Y = Pos.Bottom (_settingsPane),
 			Width = Dim.Fill (),
 			Height = Dim.Fill (1), // + 1 for status bar
-			ColorScheme = Colors.Dialog
+			ColorScheme = Colors.ColorSchemes ["Dialog"]
 		};
 
 		Application.Top.Add (_leftPane, _settingsPane, _hostPane);
@@ -340,7 +340,7 @@ public class AllViewsTester : Scenario {
 
 		// Set the colorscheme to make it stand out if is null by default
 		if (view.ColorScheme == null) {
-			view.ColorScheme = Colors.Base;
+			view.ColorScheme = Colors.ColorSchemes ["Base"];
 		}
 
 		// If the view supports a Text property, set it so we have something to look at

+ 1 - 1
UICatalog/Scenarios/AutoSizeAndDirectionText.cs

@@ -8,7 +8,7 @@ namespace UICatalog.Scenarios {
 		{
 			var text = "Hello World";
 			var wideText = "Hello World 你";
-			var color = Colors.Dialog;
+			var color = Colors.ColorSchemes ["Dialog"];
 
 			var labelH = new Label (text, TextDirection.LeftRight_TopBottom) {
 				X = 1,

+ 3 - 3
UICatalog/Scenarios/BackgroundWorkerCollection.cs

@@ -169,7 +169,7 @@ namespace UICatalog.Scenarios {
 				Width = Dim.Percent (80);
 				Height = Dim.Percent (50);
 
-				ColorScheme = Colors.Base;
+				ColorScheme = Colors.ColorSchemes ["Base"];
 
 				var label = new Label ("Worker collection Log") {
 					X = Pos.Center (),
@@ -308,14 +308,14 @@ namespace UICatalog.Scenarios {
 				Width = Dim.Percent (85);
 				Height = Dim.Percent (85);
 
-				ColorScheme = Colors.Dialog;
+				ColorScheme = Colors.ColorSchemes ["Dialog"];
 
 				Title = "Run Worker";
 
 				label = new Label ("Press start to do the work or close to quit.") {
 					X = Pos.Center (),
 					Y = 1,
-					ColorScheme = Colors.Dialog
+					ColorScheme = Colors.ColorSchemes ["Dialog"]
 				};
 				Add (label);
 

+ 3 - 2
UICatalog/Scenarios/BasicColors.cs

@@ -91,9 +91,10 @@ namespace UICatalog.Scenarios {
 					var fore = e.MouseEvent.View.GetNormalColor ().Foreground;
 					var back = e.MouseEvent.View.GetNormalColor ().Background;
 					lblForeground.Text = $"#{fore.R:X2}{fore.G:X2}{fore.B:X2} {fore.ColorName} ";
-					viewForeground.ColorScheme.Normal = new Attribute (fore, fore);
+					viewForeground.ColorScheme = new ColorScheme (viewForeground.ColorScheme) { Normal = new Attribute (fore, fore) };
+
 					lblBackground.Text = $"#{back.R:X2}{back.G:X2}{back.B:X2} {back.ColorName} ";
-					viewBackground.ColorScheme.Normal = new Attribute (back, back);
+					viewBackground.ColorScheme = new ColorScheme (viewBackground.ColorScheme) { Normal = new Attribute (back, back) };
 				}
 			};
 		}

+ 7 - 7
UICatalog/Scenarios/Buttons.cs

@@ -99,7 +99,7 @@ public class Buttons : Scenario {
 		var removeButton = new Button ("Remove this button") {
 			X = 2,
 			Y = Pos.Bottom (button) + 1,
-			ColorScheme = Colors.Error
+			ColorScheme = Colors.ColorSchemes ["Error"]
 		};
 		Win.Add (removeButton);
 		// This in interesting test case because `moveBtn` and below are laid out relative to this one!
@@ -123,7 +123,7 @@ public class Buttons : Scenario {
 			X = 0,
 			Y = Pos.Center () - 1,
 			Width = 30,
-			ColorScheme = Colors.Error,
+			ColorScheme = Colors.ColorSchemes ["Error"],
 		};
 		moveBtn.Clicked += (s, e) => {
 			moveBtn.X = moveBtn.Frame.X + 5;
@@ -137,7 +137,7 @@ public class Buttons : Scenario {
 			X = 0,
 			Y = Pos.Center () + 1,
 			Width = 30,
-			ColorScheme = Colors.Error,
+			ColorScheme = Colors.ColorSchemes ["Error"],
 		};
 		sizeBtn.Clicked += (s, e) => {
 			sizeBtn.Width = sizeBtn.Frame.Width + 5;
@@ -155,7 +155,7 @@ public class Buttons : Scenario {
 
 		// Demonstrates how changing the View.Frame property can move Views
 		var moveBtnA = new Button (0, 0, "Move This Button via Frame") {
-			ColorScheme = Colors.Error,
+			ColorScheme = Colors.ColorSchemes ["Error"],
 		};
 		moveBtnA.Clicked += (s, e) => {
 			moveBtnA.Frame = new Rect (moveBtnA.Frame.X + 5, moveBtnA.Frame.Y, moveBtnA.Frame.Width, moveBtnA.Frame.Height);
@@ -164,7 +164,7 @@ public class Buttons : Scenario {
 
 		// Demonstrates how changing the View.Frame property can SIZE Views (#583)
 		var sizeBtnA = new Button (0, 2, " ~  s  gui.cs   master ↑10 = Со_хранить") {
-			ColorScheme = Colors.Error,
+			ColorScheme = Colors.ColorSchemes ["Error"],
 		};
 		sizeBtnA.Clicked += (s, e) => {
 			sizeBtnA.Frame = new Rect (sizeBtnA.Frame.X, sizeBtnA.Frame.Y, sizeBtnA.Frame.Width + 5, sizeBtnA.Frame.Height);
@@ -215,7 +215,7 @@ public class Buttons : Scenario {
 			X = 2,
 			Y = Pos.Bottom (radioGroup) + 1,
 			Width = Dim.Width (computedFrame) - 2,
-			ColorScheme = Colors.TopLevel,
+			ColorScheme = Colors.ColorSchemes ["TopLevel"],
 		};
 		moveHotKeyBtn.Clicked += (s, e) => {
 			moveHotKeyBtn.Text = MoveHotkey (moveHotKeyBtn.Text);
@@ -227,7 +227,7 @@ public class Buttons : Scenario {
 			X = Pos.Left (absoluteFrame) + 1,
 			Y = Pos.Bottom (radioGroup) + 1,
 			Width = Dim.Width (absoluteFrame) - 2, // BUGBUG: Not always the width isn't calculated correctly.
-			ColorScheme = Colors.TopLevel,
+			ColorScheme = Colors.ColorSchemes ["TopLevel"],
 		};
 		moveUnicodeHotKeyBtn.Clicked += (s, e) => {
 			moveUnicodeHotKeyBtn.Text = MoveHotkey (moveUnicodeHotKeyBtn.Text);

+ 2 - 2
UICatalog/Scenarios/CharacterMap.cs

@@ -36,7 +36,7 @@ public class CharacterMap : Scenario {
 	public override void Init ()
 	{
 		Application.Init ();
-		Application.Top.ColorScheme = Colors.Base;
+		Application.Top.ColorScheme = Colors.ColorSchemes ["Base"];
 	}
 
 	public override void Setup ()
@@ -330,7 +330,7 @@ class CharMap : ScrollView {
 
 	public CharMap ()
 	{
-		ColorScheme = Colors.Dialog;
+		ColorScheme = Colors.ColorSchemes ["Dialog"];
 		CanFocus = true;
 		ContentSize = new Size (RowWidth, (int)((MaxCodePoint / 16 + (ShowHorizontalScrollIndicator ? 2 : 1)) * _rowHeight));
 

+ 6 - 6
UICatalog/Scenarios/Clipping.cs

@@ -10,7 +10,7 @@ namespace UICatalog.Scenarios {
 		public override void Init ()
 		{
 			Application.Init ();
-			Application.Top.ColorScheme = Colors.Base;
+			Application.Top.ColorScheme = Colors.ColorSchemes ["Base"];
 		}
 
 		public override void Setup ()
@@ -21,12 +21,12 @@ namespace UICatalog.Scenarios {
 			//Win.Height = Dim.Fill () - 2;
 			var label = new Label ("ScrollView (new Rect (3, 3, 50, 20)) with a 200, 100 ContentSize...") {
 				X = 0, Y = 0,
-				//ColorScheme = Colors.Dialog
+				//ColorScheme = Colors.ColorSchemes ["Dialog"]
 			};
 			Application.Top.Add (label);
 
 			var scrollView = new ScrollView (new Rect (3, 3, 50, 20));
-			scrollView.ColorScheme = Colors.Menu;
+			scrollView.ColorScheme = Colors.ColorSchemes ["Menu"];
 			scrollView.ContentSize = new Size (200, 100);
 			//ContentOffset = new Point (0, 0),
 			//scrollView.ShowVerticalScrollIndicator = true;
@@ -38,7 +38,7 @@ namespace UICatalog.Scenarios {
 				Y = 3,
 				Width = Dim.Fill (3),
 				Height = Dim.Fill (3),
-				ColorScheme = Colors.Dialog,
+				ColorScheme = Colors.ColorSchemes ["Dialog"],
 				Id = "1"
 			};
 
@@ -48,7 +48,7 @@ namespace UICatalog.Scenarios {
 				Y = 3,
 				Width = Dim.Fill (3),
 				Height = Dim.Fill (3),
-				ColorScheme = Colors.Error,
+				ColorScheme = Colors.ColorSchemes ["Error"],
 				Id = "2"
 			};
 			embedded1.Add (embedded2);
@@ -59,7 +59,7 @@ namespace UICatalog.Scenarios {
 				Y = 3,
 				Width = Dim.Fill (3),
 				Height = Dim.Fill (3),
-				ColorScheme = Colors.TopLevel,
+				ColorScheme = Colors.ColorSchemes ["TopLevel"],
 				Id = "3"
 			};
 

+ 1 - 1
UICatalog/Scenarios/CollectionNavigatorTester.cs

@@ -16,7 +16,7 @@ namespace UICatalog.Scenarios {
 		public override void Init ()
 		{
 			Application.Init ();
-			Application.Top.ColorScheme = Colors.Base;
+			Application.Top.ColorScheme = Colors.ColorSchemes ["Base"];
 		}
 
 		System.Collections.Generic.List<string> _items = new string [] {

+ 1 - 1
UICatalog/Scenarios/ComboBoxIteration.cs

@@ -24,7 +24,7 @@ namespace UICatalog.Scenarios {
 			Win.Add (listview);
 
 			var lbComboBox = new Label () {
-				ColorScheme = Colors.TopLevel,
+				ColorScheme = Colors.ColorSchemes ["TopLevel"],
 				X = Pos.Right (lbListView) + 1,
 				Width = Dim.Percent (40)
 			};

+ 13 - 13
UICatalog/Scenarios/ComputedLayout.cs

@@ -33,7 +33,7 @@ namespace UICatalog.Scenarios {
 				Y = 0,
 				Width = Dim.Fill (),
 				Height = 1,
-				ColorScheme = Colors.Error
+				ColorScheme = Colors.ColorSchemes ["Error"]
 			};
 
 			Application.Top.Add (horizontalRuler);
@@ -47,7 +47,7 @@ namespace UICatalog.Scenarios {
 				Y = 0,
 				Width = 1,
 				Height = Dim.Fill (),
-				ColorScheme = Colors.Error
+				ColorScheme = Colors.ColorSchemes ["Error"]
 			};
 
 			Application.Top.LayoutComplete += (s, a) => {
@@ -88,10 +88,10 @@ namespace UICatalog.Scenarios {
 			string txt = "Resize the terminal to see computed layout in action.";
 			var labelList = new List<Label> ();
 			labelList.Add (new Label ($"The lines below show different TextAlignments"));
-			labelList.Add (new Label ($"{i++}-{txt}") { TextAlignment = Terminal.Gui.TextAlignment.Left, Width = Dim.Fill (), X = 0, Y = Pos.Bottom (labelList.LastOrDefault ()), ColorScheme = Colors.Dialog });
-			labelList.Add (new Label ($"{i++}-{txt}") { TextAlignment = Terminal.Gui.TextAlignment.Right, Width = Dim.Fill (), X = 0, Y = Pos.Bottom (labelList.LastOrDefault ()), ColorScheme = Colors.Dialog });
-			labelList.Add (new Label ($"{i++}-{txt}") { TextAlignment = Terminal.Gui.TextAlignment.Centered, Width = Dim.Fill (), X = 0, Y = Pos.Bottom (labelList.LastOrDefault ()), ColorScheme = Colors.Dialog });
-			labelList.Add (new Label ($"{i++}-{txt}") { TextAlignment = Terminal.Gui.TextAlignment.Justified, Width = Dim.Fill (), X = 0, Y = Pos.Bottom (labelList.LastOrDefault ()), ColorScheme = Colors.Dialog });
+			labelList.Add (new Label ($"{i++}-{txt}") { TextAlignment = Terminal.Gui.TextAlignment.Left, Width = Dim.Fill (), X = 0, Y = Pos.Bottom (labelList.LastOrDefault ()), ColorScheme = Colors.ColorSchemes ["Dialog"] });
+			labelList.Add (new Label ($"{i++}-{txt}") { TextAlignment = Terminal.Gui.TextAlignment.Right, Width = Dim.Fill (), X = 0, Y = Pos.Bottom (labelList.LastOrDefault ()), ColorScheme = Colors.ColorSchemes ["Dialog"] });
+			labelList.Add (new Label ($"{i++}-{txt}") { TextAlignment = Terminal.Gui.TextAlignment.Centered, Width = Dim.Fill (), X = 0, Y = Pos.Bottom (labelList.LastOrDefault ()), ColorScheme = Colors.ColorSchemes ["Dialog"] });
+			labelList.Add (new Label ($"{i++}-{txt}") { TextAlignment = Terminal.Gui.TextAlignment.Justified, Width = Dim.Fill (), X = 0, Y = Pos.Bottom (labelList.LastOrDefault ()), ColorScheme = Colors.ColorSchemes ["Dialog"] });
 			subWin.Add (labelList.ToArray ());
 
 			var frameView = new FrameView () {
@@ -107,10 +107,10 @@ namespace UICatalog.Scenarios {
 			i = 1;
 			labelList = new List<Label> ();
 			labelList.Add (new Label ($"The lines below show different TextAlignments"));
-			labelList.Add (new Label ($"{i++}-{txt}") { TextAlignment = Terminal.Gui.TextAlignment.Left, Width = Dim.Fill (), X = 0, Y = Pos.Bottom (labelList.LastOrDefault ()), ColorScheme = Colors.Dialog });
-			labelList.Add (new Label ($"{i++}-{txt}") { TextAlignment = Terminal.Gui.TextAlignment.Right, Width = Dim.Fill (), X = 0, Y = Pos.Bottom (labelList.LastOrDefault ()), ColorScheme = Colors.Dialog });
-			labelList.Add (new Label ($"{i++}-{txt}") { TextAlignment = Terminal.Gui.TextAlignment.Centered, Width = Dim.Fill (), X = 0, Y = Pos.Bottom (labelList.LastOrDefault ()), ColorScheme = Colors.Dialog });
-			labelList.Add (new Label ($"{i++}-{txt}") { TextAlignment = Terminal.Gui.TextAlignment.Justified, Width = Dim.Fill (), X = 0, Y = Pos.Bottom (labelList.LastOrDefault ()), ColorScheme = Colors.Dialog });
+			labelList.Add (new Label ($"{i++}-{txt}") { TextAlignment = Terminal.Gui.TextAlignment.Left, Width = Dim.Fill (), X = 0, Y = Pos.Bottom (labelList.LastOrDefault ()), ColorScheme = Colors.ColorSchemes ["Dialog"] });
+			labelList.Add (new Label ($"{i++}-{txt}") { TextAlignment = Terminal.Gui.TextAlignment.Right, Width = Dim.Fill (), X = 0, Y = Pos.Bottom (labelList.LastOrDefault ()), ColorScheme = Colors.ColorSchemes ["Dialog"] });
+			labelList.Add (new Label ($"{i++}-{txt}") { TextAlignment = Terminal.Gui.TextAlignment.Centered, Width = Dim.Fill (), X = 0, Y = Pos.Bottom (labelList.LastOrDefault ()), ColorScheme = Colors.ColorSchemes ["Dialog"] });
+			labelList.Add (new Label ($"{i++}-{txt}") { TextAlignment = Terminal.Gui.TextAlignment.Justified, Width = Dim.Fill (), X = 0, Y = Pos.Bottom (labelList.LastOrDefault ()), ColorScheme = Colors.ColorSchemes ["Dialog"] });
 			frameView.Add (labelList.ToArray ());
 			Application.Top.Add (frameView);
 
@@ -132,7 +132,7 @@ namespace UICatalog.Scenarios {
 				Y = Pos.Percent (50),
 				Width = Dim.Percent (80),
 				Height = Dim.Percent (10),
-				ColorScheme = Colors.TopLevel,
+				ColorScheme = Colors.ColorSchemes ["TopLevel"],
 			};
 			textView.Text = $"This TextView should horizontally & vertically centered and \n10% of the screeen height, and 80% of its width.";
 			Application.Top.Add (textView);
@@ -242,7 +242,7 @@ namespace UICatalog.Scenarios {
 			// This is intentionally convoluted to illustrate potential bugs.
 			var anchorEndLabel1 = new Label ("This Label should be the 2nd to last line (AnchorEnd (2)).") {
 				TextAlignment = Terminal.Gui.TextAlignment.Centered,
-				ColorScheme = Colors.Menu,
+				ColorScheme = Colors.ColorSchemes ["Menu"],
 				Width = Dim.Fill (5),
 				X = 5,
 				Y = Pos.AnchorEnd (2)
@@ -253,7 +253,7 @@ namespace UICatalog.Scenarios {
 			// This is intentionally convoluted to illustrate potential bugs.
 			var anchorEndLabel2 = new TextField ("This TextField should be the 3rd to last line (AnchorEnd (2) - 1).") {
 				TextAlignment = Terminal.Gui.TextAlignment.Left,
-				ColorScheme = Colors.Menu,
+				ColorScheme = Colors.ColorSchemes ["Menu"],
 				Width = Dim.Fill (5),
 				X = 5,
 				Y = Pos.AnchorEnd (2) - 1 // Pos.Combine

+ 1 - 1
UICatalog/Scenarios/Dialogs.cs

@@ -143,7 +143,7 @@ namespace UICatalog.Scenarios {
 				Y = Pos.Bottom (frame) + 5,
 				Width = 25,
 				Height = 1,
-				ColorScheme = Colors.Error,
+				ColorScheme = Colors.ColorSchemes ["Error"],
 			};
 			// glyphsNotWords
 			// false:var btnText = new [] { "Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine" };

+ 2 - 2
UICatalog/Scenarios/DynamicMenuBar.cs

@@ -140,7 +140,7 @@ namespace UICatalog.Scenarios {
 				_frmMenu.Add (_btnNext);
 
 				var _lblMenuBar = new Label () {
-					ColorScheme = Colors.Dialog,
+					ColorScheme = Colors.ColorSchemes ["Dialog"],
 					TextAlignment = TextAlignment.Centered,
 					X = Pos.Right (_btnPrevious) + 1,
 					Y = Pos.Top (_btnPrevious),
@@ -166,7 +166,7 @@ namespace UICatalog.Scenarios {
 				_frmMenu.Add (_btnPreviowsParent);
 
 				_lstMenus = new ListView (new List<DynamicMenuItemList> ()) {
-					ColorScheme = Colors.Dialog,
+					ColorScheme = Colors.ColorSchemes ["Dialog"],
 					X = Pos.Right (_btnPrevious) + 1,
 					Y = Pos.Top (_btnPrevious) + 2,
 					Width = _lblMenuBar.Width,

+ 1 - 1
UICatalog/Scenarios/DynamicStatusBar.cs

@@ -105,7 +105,7 @@ public class DynamicStatusBar : Scenario {
 			_frmStatusBar.Add (_btnAdd);
 
 			_lstItems = new ListView (new List<DynamicStatusItemList> ()) {
-				ColorScheme = Colors.Dialog,
+				ColorScheme = Colors.ColorSchemes ["Dialog"],
 				Y = Pos.Top (_btnAddStatusBar) + 2,
 				Width = Dim.Fill () - Dim.Width (_btnAdd) - 1,
 				Height = Dim.Fill (),

+ 1 - 1
UICatalog/Scenarios/Editor.cs

@@ -741,7 +741,7 @@ namespace UICatalog.Scenarios {
 				Title = isFind ? "Find" : "Replace",
 				X = Win.Bounds.Width / 2 - 30,
 				Y = Win.Bounds.Height / 2 - 10,
-				ColorScheme = Colors.TopLevel
+				ColorScheme = Colors.ColorSchemes ["TopLevel"]
 			};
 
 			_tabView = new TabView () {

+ 6 - 4
UICatalog/Scenarios/InvertColors.cs

@@ -10,7 +10,7 @@ namespace UICatalog.Scenarios {
 	public class InvertColors : Scenario {
 		public override void Setup ()
 		{
-			Win.ColorScheme = Colors.TopLevel;
+			Win.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 
 			List<Label> labels = new List<Label> ();
 			var foreColors = Enum.GetValues (typeof (ColorName)).Cast<ColorName> ().ToArray ();
@@ -24,7 +24,7 @@ namespace UICatalog.Scenarios {
 					ColorScheme = new ColorScheme (),
 					Y = y
 				};
-				label.ColorScheme.Normal = color;
+				label.ColorScheme = new ColorScheme (label.ColorScheme) { Normal = color };
 				Win.Add (label);
 				labels.Add (label);
 			}
@@ -33,13 +33,15 @@ namespace UICatalog.Scenarios {
 				X = Pos.Center (),
 				Y = foreColors.Length + 1,
 			};
-			button.Clicked += (s,e) => {
+			button.Clicked += (s, e) => {
 
 				foreach (var label in labels) {
 					var color = label.ColorScheme.Normal;
 					color = new Attribute (color.Background, color.Foreground);
 
-					label.ColorScheme.Normal = color;
+					label.ColorScheme = new ColorScheme (label.ColorScheme) {
+						Normal = color
+					};
 					label.Text = $"{color.Foreground} on {color.Background}";
 					label.SetNeedsDisplay ();
 

+ 5 - 5
UICatalog/Scenarios/Keys.cs

@@ -46,7 +46,7 @@ public class Keys : Scenario {
 			X = Pos.Right (keyPressedLabel) + 1,
 			Y = Pos.Top (keyPressedLabel),
 			TextAlignment = Terminal.Gui.TextAlignment.Centered,
-			ColorScheme = Colors.Error,
+			ColorScheme = Colors.ColorSchemes ["Error"],
 			AutoSize = true
 		};
 		Win.Add (labelTextViewKeypress);
@@ -62,7 +62,7 @@ public class Keys : Scenario {
 			X = Pos.Right (keyPressedLabel) + 1,
 			Y = Pos.Top (keyPressedLabel),
 			TextAlignment = Terminal.Gui.TextAlignment.Centered,
-			ColorScheme = Colors.Error,
+			ColorScheme = Colors.ColorSchemes ["Error"],
 			AutoSize = true
 		};
 		Win.Add (labelAppKeypress);
@@ -84,7 +84,7 @@ public class Keys : Scenario {
 			Width = "Key Down:".Length + maxKeyString,
 			Height = Dim.Fill (),
 		};
-		keyEventListView.ColorScheme = Colors.TopLevel;
+		keyEventListView.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 		Win.Add (keyEventListView);
 
 		// OnKeyPressed
@@ -101,7 +101,7 @@ public class Keys : Scenario {
 			Width = maxKeyString,
 			Height = Dim.Fill (),
 		};
-		onKeyPressedListView.ColorScheme = Colors.TopLevel;
+		onKeyPressedListView.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 		Win.Add (onKeyPressedListView);
 
 		// OnInvokeKeyBindings
@@ -116,7 +116,7 @@ public class Keys : Scenario {
 			Width = Dim.Fill (1),
 			Height = Dim.Fill (),
 		};
-		onInvokingKeyBindingsListView.ColorScheme = Colors.TopLevel;
+		onInvokingKeyBindingsListView.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 		Win.Add (onInvokingKeyBindingsListView);
 
 		//Application.KeyDown += (s, a) => KeyDownPressUp (a, "Down");

+ 7 - 7
UICatalog/Scenarios/LabelsAsButtons.cs

@@ -114,7 +114,7 @@ namespace UICatalog.Scenarios {
 			var removeLabel = new Label ("Remove this Label") {
 				X = 2,
 				Y = Pos.Bottom (Label) + 1,
-				ColorScheme = Colors.Error,
+				ColorScheme = Colors.ColorSchemes ["Error"],
 				HotKeySpecifier = (Rune)'_',
 				CanFocus = true,
 			};
@@ -141,7 +141,7 @@ namespace UICatalog.Scenarios {
 				X = 0,
 				Y = Pos.Center () - 1,
 				Width = 30,
-				ColorScheme = Colors.Error,
+				ColorScheme = Colors.ColorSchemes ["Error"],
 				HotKeySpecifier = (Rune)'_',
 				CanFocus = true,
 			};
@@ -158,7 +158,7 @@ namespace UICatalog.Scenarios {
 				X = 0,
 				Y = Pos.Center () + 1,
 				Width = 30,
-				ColorScheme = Colors.Error,
+				ColorScheme = Colors.ColorSchemes ["Error"],
 				HotKeySpecifier = (Rune)'_',
 				CanFocus = true,
 				AutoSize = false
@@ -179,7 +179,7 @@ namespace UICatalog.Scenarios {
 
 			// Demonstrates how changing the View.Frame property can move Views
 			var moveBtnA = new Label (0, 0, "Move This Label via Frame") {
-				ColorScheme = Colors.Error,
+				ColorScheme = Colors.ColorSchemes ["Error"],
 				HotKeySpecifier = (Rune)'_',
 				CanFocus = true,
 			};
@@ -190,7 +190,7 @@ namespace UICatalog.Scenarios {
 
 			// Demonstrates how changing the View.Frame property can SIZE Views (#583)
 			var sizeBtnA = new Label (0, 2, " ~  s  gui.cs   master ↑10 = Со_хранить") {
-				ColorScheme = Colors.Error,
+				ColorScheme = Colors.ColorSchemes ["Error"],
 				HotKeySpecifier = (Rune)'_',
 				CanFocus = true,
 				AutoSize = false
@@ -246,7 +246,7 @@ namespace UICatalog.Scenarios {
 				X = 2,
 				Y = Pos.Bottom (radioGroup) + 1,
 				Width = Dim.Width (computedFrame) - 2,
-				ColorScheme = Colors.TopLevel,
+				ColorScheme = Colors.ColorSchemes ["TopLevel"],
 				HotKeySpecifier = (Rune)'_',
 				CanFocus = true,
 			};
@@ -260,7 +260,7 @@ namespace UICatalog.Scenarios {
 				X = Pos.Left (absoluteFrame) + 1,
 				Y = Pos.Bottom (radioGroup) + 1,
 				Width = Dim.Width (absoluteFrame) - 2,
-				ColorScheme = Colors.TopLevel,
+				ColorScheme = Colors.ColorSchemes ["TopLevel"],
 				HotKeySpecifier = (Rune)'_',
 				CanFocus = true,
 			};

+ 2 - 2
UICatalog/Scenarios/LineCanvasExperiment.cs

@@ -123,10 +123,10 @@ namespace UICatalog.Scenarios {
 				Y = 8,
 				Width = 25,
 				Height = 10,
-				//ColorScheme = Colors.Error,
+				//ColorScheme = Colors.ColorSchemes ["Error"],
 				SuperViewRendersLineCanvas = true
 			};
-			marginWindow.Margin.ColorScheme = Colors.Dialog;
+			marginWindow.Margin.ColorScheme = Colors.ColorSchemes ["Dialog"];
 			marginWindow.Margin.Thickness = new Thickness (1);
 			marginWindow.Border.Thickness = new Thickness (1,2,1,1);
 

+ 1 - 1
UICatalog/Scenarios/ListViewWithSelection.cs

@@ -50,7 +50,7 @@ namespace UICatalog.Scenarios {
 				Y = 2,
 				Height = Dim.Fill (),
 				Width = Dim.Fill (1),
-				//ColorScheme = Colors.TopLevel,
+				//ColorScheme = Colors.ColorSchemes ["TopLevel"],
 				AllowsMarking = false,
 				AllowsMultipleSelection = false
 			};

+ 2 - 2
UICatalog/Scenarios/ListsAndCombos.cs

@@ -25,7 +25,7 @@ namespace UICatalog.Scenarios {
 
 			// ListView
 			var lbListView = new Label ("Listview") {
-				ColorScheme = Colors.TopLevel,
+				ColorScheme = Colors.ColorSchemes ["TopLevel"],
 				X = 0,
 				Width = Dim.Percent (40)
 			};
@@ -67,7 +67,7 @@ namespace UICatalog.Scenarios {
 
 			// ComboBox
 			var lbComboBox = new Label ("ComboBox") {
-				ColorScheme = Colors.TopLevel,
+				ColorScheme = Colors.ColorSchemes ["TopLevel"],
 				X = Pos.Right (lbListView) + 1,
 				Width = Dim.Percent(40)
 			};

+ 1 - 1
UICatalog/Scenarios/MenuBarScenario.cs

@@ -53,7 +53,7 @@ public class MenuBarScenario : Scenario {
 	public override void Init ()
 	{
 		Application.Init ();
-		Application.Top.ColorScheme = Colors.Base;
+		Application.Top.ColorScheme = Colors.ColorSchemes ["Base"];
 	}
 
 	Label _currentMenuBarItem;

+ 1 - 1
UICatalog/Scenarios/MessageBoxes.cs

@@ -175,7 +175,7 @@ namespace UICatalog.Scenarios {
 				Y = Pos.Bottom (frame) + 5,
 				Width = 25,
 				Height = 1,
-				ColorScheme = Colors.Error,
+				ColorScheme = Colors.ColorSchemes ["Error"],
 				TextAlignment = Terminal.Gui.TextAlignment.Centered
 			};
 

+ 1 - 1
UICatalog/Scenarios/Mouse.cs

@@ -23,7 +23,7 @@ namespace UICatalog.Scenarios {
 				Y = Pos.Top (test) + 1,
 				Width = Dim.Fill () - 1,
 				Height = Dim.Fill (),
-				ColorScheme = Colors.TopLevel
+				ColorScheme = Colors.ColorSchemes ["TopLevel"]
 			};
 			Win.Add (rmeList);
 

+ 1 - 1
UICatalog/Scenarios/Notepad.cs

@@ -17,7 +17,7 @@ public class Notepad : Scenario {
 	public override void Init ()
 	{
 		Application.Init ();
-		Application.Top.ColorScheme = Colors.Base;
+		Application.Top.ColorScheme = Colors.ColorSchemes ["Base"];
 	}
 
 	public override void Setup ()

+ 3 - 3
UICatalog/Scenarios/Progress.cs

@@ -36,7 +36,7 @@ namespace UICatalog.Scenarios {
 
 			internal ProgressDemo (string title) : base (title)
 			{
-				ColorScheme = Colors.Dialog;
+				ColorScheme = Colors.ColorSchemes ["Dialog"];
 
 				LeftFrame = new FrameView ("Settings") {
 					X = 0,
@@ -81,7 +81,7 @@ namespace UICatalog.Scenarios {
 					Width = Dim.Fill () - 1,
 					Height = 1,
 					Fraction = 0.25F,
-					ColorScheme = Colors.Error
+					ColorScheme = Colors.ColorSchemes ["Error"]
 				};
 				Add (ActivityProgressBar);
 
@@ -102,7 +102,7 @@ namespace UICatalog.Scenarios {
 					Y = Pos.Bottom (ActivityProgressBar) + 1,
 					Width = Dim.Fill () - Spinner.Width,
 					Height = 1,
-					ColorScheme = Colors.Error
+					ColorScheme = Colors.ColorSchemes ["Error"]
 				};
 				Add (PulseProgressBar);
 

+ 1 - 1
UICatalog/Scenarios/RuneWidthGreaterThanOne.cs

@@ -40,7 +40,7 @@ namespace UICatalog.Scenarios {
 				X = Pos.Center (),
 				Y = 1,
 				ColorScheme = new ColorScheme () {
-					Normal = Colors.Base.Focus
+					Normal = Colors.ColorSchemes ["Base"].Focus
 				}
 			};
 			_text = new TextField () {

+ 6 - 6
UICatalog/Scenarios/Scrolling.cs

@@ -119,7 +119,7 @@ namespace UICatalog.Scenarios {
 				Y = Pos.Bottom (label) + 1,
 				Width = 50,
 				Height = 20,
-				ColorScheme = Colors.TopLevel,
+				ColorScheme = Colors.ColorSchemes ["TopLevel"],
 				ContentSize = new Size (200, 100),
 				//ContentOffset = new Point (0, 0),
 				ShowVerticalScrollIndicator = true,
@@ -134,7 +134,7 @@ namespace UICatalog.Scenarios {
 				Y = 0,
 				Width = Dim.Fill (),
 				Height = 2,
-				ColorScheme = Colors.Error,
+				ColorScheme = Colors.ColorSchemes ["Error"],
 				AutoSize = false
 			};
 			scrollView.Add (horizontalRuler);
@@ -146,7 +146,7 @@ namespace UICatalog.Scenarios {
 				Y = 0,
 				Width = 1,
 				Height = Dim.Fill (),
-				ColorScheme = Colors.Error,
+				ColorScheme = Colors.ColorSchemes ["Error"],
 				AutoSize = false
 			};
 			scrollView.Add (verticalRuler);
@@ -179,21 +179,21 @@ namespace UICatalog.Scenarios {
 				X = 3,
 				Y = 5,
 				Width = 50,
-				ColorScheme = Colors.Dialog
+				ColorScheme = Colors.ColorSchemes ["Dialog"]
 			});
 
 			scrollView.Add (new TextField ("... the emergency broadcast system.") {
 				X = 3,
 				Y = 10,
 				Width = 50,
-				ColorScheme = Colors.Dialog
+				ColorScheme = Colors.ColorSchemes ["Dialog"]
 			});
 
 			scrollView.Add (new TextField ("Last line") {
 				X = 3,
 				Y = 99,
 				Width = 50,
-				ColorScheme = Colors.Dialog
+				ColorScheme = Colors.ColorSchemes ["Dialog"]
 			});
 
 			// Demonstrate AnchorEnd - Button is anchored to bottom/right

+ 1 - 1
UICatalog/Scenarios/SingleBackgroundWorker.cs

@@ -160,7 +160,7 @@ namespace UICatalog.Scenarios {
 				top.Add (statusBar);
 
 				Title = $"Worker started at {start}.{start:fff}";
-				ColorScheme = Colors.Base;
+				ColorScheme = Colors.ColorSchemes ["Base"];
 
 				Add (new ListView (list) {
 					X = 0,

+ 7 - 4
UICatalog/Scenarios/Sliders.cs

@@ -18,7 +18,7 @@ public class Sliders : Scenario {
 			Y = 0,
 			Width = Dim.Fill (),
 			Height = Dim.Fill (),
-			ColorScheme = Colors.Dialog
+			ColorScheme = Colors.ColorSchemes ["Dialog"]
 		};
 
 		Win.Add (configView);
@@ -216,7 +216,9 @@ public class Sliders : Scenario {
 				var data = e.Options.First ().Value.Data;
 				foreach (var s in Win.Subviews.OfType<Slider> ()) {
 					s.ColorScheme = new ColorScheme (s.ColorScheme);
-					s.ColorScheme.Normal = new Attribute (data.Item2, s.ColorScheme.Normal.Background);
+					s.ColorScheme = new ColorScheme(s.ColorScheme) {
+						Normal = new Attribute (data.Item2, s.ColorScheme.Normal.Background)
+					};
 
 					s.Style.OptionChar.Attribute = new Attribute (data.Item1, s.ColorScheme.Normal.Background);
 					s.Style.SetChar.Attribute = new Attribute (data.Item1, s.Style.SetChar.Attribute?.Background ?? s.ColorScheme.Normal.Background);
@@ -252,8 +254,9 @@ public class Sliders : Scenario {
 				var data = e.Options.First ().Value.Data;
 
 				foreach (var s in Win.Subviews.OfType<Slider> ()) {
-					s.ColorScheme = new ColorScheme (s.ColorScheme);
-					s.ColorScheme.Normal = new Attribute (s.ColorScheme.Normal.Foreground, data.Item2);
+					s.ColorScheme = new ColorScheme (s.ColorScheme) {
+						Normal = new Attribute (s.ColorScheme.Normal.Foreground, data.Item2)
+					};
 				}
 			}
 		};

+ 3 - 3
UICatalog/Scenarios/TextAlignments.cs

@@ -23,8 +23,8 @@ namespace UICatalog.Scenarios {
 			var multiLineHeight = 5;
 
 			foreach (var alignment in alignments) {
-				singleLines [(int)alignment] = new Label (txt) { TextAlignment = alignment, X = 1, Width = Dim.Fill (1), Height = 1, ColorScheme = Colors.Dialog, AutoSize = false };
-				multipleLines [(int)alignment] = new Label (txt) { TextAlignment = alignment, X = 1, Width = Dim.Fill (1), Height = multiLineHeight, ColorScheme = Colors.Dialog, AutoSize = false };
+				singleLines [(int)alignment] = new Label (txt) { TextAlignment = alignment, X = 1, Width = Dim.Fill (1), Height = 1, ColorScheme = Colors.ColorSchemes ["Dialog"], AutoSize = false };
+				multipleLines [(int)alignment] = new Label (txt) { TextAlignment = alignment, X = 1, Width = Dim.Fill (1), Height = multiLineHeight, ColorScheme = Colors.ColorSchemes ["Dialog"], AutoSize = false };
 			}
 
 			// Add a label & text field so we can demo IsDefault
@@ -38,7 +38,7 @@ namespace UICatalog.Scenarios {
 				Y = Pos.Y (editLabel),
 				Width = Dim.Fill ("Text:".Length + "  Unicode Sample".Length + 2),
 				Height = 4,
-				ColorScheme = Colors.TopLevel,
+				ColorScheme = Colors.ColorSchemes ["TopLevel"],
 				Text = txt,
 			};
 			edit.TextChanged += (s,e) => {

+ 1 - 1
UICatalog/Scenarios/TextAlignmentsAndDirection.cs

@@ -105,7 +105,7 @@ namespace UICatalog.Scenarios {
 				Y = Pos.Bottom (container) + 1,
 				Width = Dim.Fill (10),
 				Height = Dim.Fill (1),
-				ColorScheme = Colors.TopLevel,
+				ColorScheme = Colors.ColorSchemes ["TopLevel"],
 				Text = txt
 			};
 

+ 4 - 4
UICatalog/Scenarios/TextFormatterDemo.cs

@@ -15,7 +15,7 @@ namespace UICatalog.Scenarios {
 			//Top.Text = "Press CTRL-Q to Quit. This is the Text for the TopLevel View. TextAlignment.Centered was specified. It is intentionally very long to illustrate word wrap.\n" +
 			//	"<-- There is a new line here to show a hard line break. You should see this text bleed underneath the subviews, which start at Y = 3.";
 			//Top.TextAlignment = TextAlignment.Centered;
-			//Top.ColorScheme = Colors.Base;
+			//Top.ColorScheme = Colors.ColorSchemes ["Base"];
 
 			// Make Win smaller so sizing the window horizontally will make the
 			// labels shrink to zero-width
@@ -25,7 +25,7 @@ namespace UICatalog.Scenarios {
 			string text = "Hello world, how are you today? Pretty neat!\nSecond line\n\nFourth Line.";
 			string unicode = "Τὴ γλῶσσα μοῦ ἔδωσαν ἑλληνικὴ\nτὸ σπίτι φτωχικὸ στὶς ἀμμουδιὲς τοῦ Ὁμήρου.\nΜονάχη ἔγνοια ἡ γλῶσσα μου στὶς ἀμμουδιὲς τοῦ Ὁμήρου.";
 
-			Label blockText = new Label () { ColorScheme = Colors.TopLevel, X = 0, Y = 0, Height = 10, Width = Dim.Fill (0), AutoSize = false };
+			Label blockText = new Label () { ColorScheme = Colors.ColorSchemes ["TopLevel"], X = 0, Y = 0, Height = 10, Width = Dim.Fill (0), AutoSize = false };
 
 			var block = new StringBuilder ();
 			block.AppendLine ("  ▄████  █    ██  ██▓      ▄████▄    ██████ ");
@@ -55,8 +55,8 @@ namespace UICatalog.Scenarios {
 			var multiLineHeight = 5;
 
 			foreach (var alignment in alignments) {
-				singleLines [(int)alignment] = new Label (text) { TextAlignment = alignment, X = 0, Width = Dim.Fill (), Height = 1, ColorScheme = Colors.Dialog, AutoSize = false };
-				multipleLines [(int)alignment] = new Label (text) { TextAlignment = alignment, X = 0, Width = Dim.Fill (), Height = multiLineHeight, ColorScheme = Colors.Dialog, AutoSize = false };
+				singleLines [(int)alignment] = new Label (text) { TextAlignment = alignment, X = 0, Width = Dim.Fill (), Height = 1, ColorScheme = Colors.ColorSchemes ["Dialog"], AutoSize = false };
+				multipleLines [(int)alignment] = new Label (text) { TextAlignment = alignment, X = 0, Width = Dim.Fill (), Height = multiLineHeight, ColorScheme = Colors.ColorSchemes ["Dialog"], AutoSize = false };
 			}
 
 			var label = new Label ($"Demonstrating single-line (should clip):") { Y = Pos.Bottom (unicodeCheckBox) + 1 };

+ 2 - 2
UICatalog/Scenarios/Threading.cs

@@ -57,7 +57,7 @@ namespace UICatalog.Scenarios {
 				Y = Pos.Y (_btnActionCancel) + 6,
 				Width = 10,
 				Height = 10,
-				ColorScheme = Colors.TopLevel
+				ColorScheme = Colors.ColorSchemes ["TopLevel"]
 			};
 
 			Win.Add (new Label ("Task Logs:") {
@@ -70,7 +70,7 @@ namespace UICatalog.Scenarios {
 				Y = Pos.Y (_itemsList),
 				Width = 50,
 				Height = Dim.Fill (),
-				ColorScheme = Colors.TopLevel
+				ColorScheme = Colors.ColorSchemes ["TopLevel"]
 			};
 
 			var text = new TextField (1, 3, 100, "Type anything after press the button");

+ 4 - 4
UICatalog/Scenarios/VkeyPacketSimulator.cs

@@ -32,7 +32,7 @@ public class VkeyPacketSimulator : Scenario {
 		var inputHorizontalRuler = new Label ("") {
 			Y = Pos.Bottom (btnInput),
 			Width = Dim.Fill (),
-			ColorScheme = Colors.Error,
+			ColorScheme = Colors.ColorSchemes ["Error"],
 			AutoSize = false
 		};
 		Win.Add (inputHorizontalRuler);
@@ -40,7 +40,7 @@ public class VkeyPacketSimulator : Scenario {
 		var inputVerticalRuler = new Label ("", TextDirection.TopBottom_LeftRight) {
 			Y = Pos.Bottom (btnInput),
 			Width = 1,
-			ColorScheme = Colors.Error,
+			ColorScheme = Colors.ColorSchemes ["Error"],
 			AutoSize = false
 		};
 		Win.Add (inputVerticalRuler);
@@ -69,7 +69,7 @@ public class VkeyPacketSimulator : Scenario {
 		var outputHorizontalRuler = new Label ("") {
 			Y = Pos.Bottom (btnOutput),
 			Width = Dim.Fill (),
-			ColorScheme = Colors.Error,
+			ColorScheme = Colors.ColorSchemes ["Error"],
 			AutoSize = false
 		};
 		Win.Add (outputHorizontalRuler);
@@ -78,7 +78,7 @@ public class VkeyPacketSimulator : Scenario {
 			Y = Pos.Bottom (btnOutput),
 			Width = 1,
 			Height = Dim.Fill (),
-			ColorScheme = Colors.Error,
+			ColorScheme = Colors.ColorSchemes ["Error"],
 			AutoSize = false
 		};
 		Win.Add (outputVerticalRuler);

+ 14 - 14
UICatalog/Scenarios/WindowsAndFrameViews.cs

@@ -31,7 +31,7 @@ namespace UICatalog.Scenarios {
 				Y = 1,
 				Width = Dim.Fill (15),
 				Height = 10,
-				ColorScheme = Colors.Dialog
+				ColorScheme = Colors.ColorSchemes ["Dialog"]
 			};
 			Win.Padding.Thickness = new Thickness (padding);
 			Win.Margin.Thickness = new Thickness (margin);
@@ -39,14 +39,14 @@ namespace UICatalog.Scenarios {
 			var paddingButton = new Button ($"Padding of container is {padding}") {
 				X = Pos.Center (),
 				Y = 0,
-				ColorScheme = Colors.Error,
+				ColorScheme = Colors.ColorSchemes ["Error"],
 			};
 			paddingButton.Clicked += (s,e) => About ();
 			Win.Add (paddingButton);
 			Win.Add (new Button ("Press ME! (Y = Pos.AnchorEnd(1))") {
 				X = Pos.Center (),
 				Y = Pos.AnchorEnd (1),
-				ColorScheme = Colors.Error
+				ColorScheme = Colors.ColorSchemes ["Error"]
 			});
 			Application.Top.Add (Win);
 			
@@ -71,11 +71,11 @@ namespace UICatalog.Scenarios {
 				};
 				win.Padding.Thickness = new Thickness (pad);
 				
-				win.ColorScheme = Colors.Dialog;
+				win.ColorScheme = Colors.ColorSchemes ["Dialog"];
 				var pressMeButton = new Button ("Press me! (Y = 0)") {
 					X = Pos.Center (),
 					Y = 0,
-					ColorScheme = Colors.Error,
+					ColorScheme = Colors.ColorSchemes ["Error"],
 				};
 				pressMeButton.Clicked += (s,e) =>
 					MessageBox.ErrorQuery (win.Title, "Neat?", "Yes", "No");
@@ -86,12 +86,12 @@ namespace UICatalog.Scenarios {
 					Y = 1,
 					Width = Dim.Percent (50),
 					Height = 5,
-					ColorScheme = Colors.Base,
+					ColorScheme = Colors.ColorSchemes ["Base"],
 					Text = "The Text in the Window",
 				};
 				subWin.Add (new TextField ("Edit me! " + win.Title) {
 					Y = 1,
-					ColorScheme = Colors.Error
+					ColorScheme = Colors.ColorSchemes ["Error"]
 				});
 				win.Add (subWin);
 				var frameView = new FrameView ("This is a Sub-FrameView") {
@@ -99,7 +99,7 @@ namespace UICatalog.Scenarios {
 					Y = 1,
 					Width = Dim.Percent (100, true), // Or Dim.Percent (50)
 					Height = 5,
-					ColorScheme = Colors.Base,
+					ColorScheme = Colors.ColorSchemes ["Base"],
 					Text = "The Text in the FrameView",
 
 				};
@@ -131,11 +131,11 @@ namespace UICatalog.Scenarios {
 				Width = Dim.Fill (margin),
 				Height = contentHeight + 2,  // 2 for default padding
 			};
-			frame.ColorScheme = Colors.Dialog;
+			frame.ColorScheme = Colors.ColorSchemes ["Dialog"];
 			frame.Add (new Label ("This is a Label! (Y = 0)") {
 				X = Pos.Center (),
 				Y = 0,
-				ColorScheme = Colors.Error,
+				ColorScheme = Colors.ColorSchemes ["Error"],
 				//Clicked = () => MessageBox.ErrorQuery (frame.Title, "Neat?", "Yes", "No")
 			});
 			var subWinofFV = new Window () {
@@ -144,11 +144,11 @@ namespace UICatalog.Scenarios {
 				Y = 1,
 				Width = Dim.Percent (50),
 				Height = Dim.Fill () - 1,
-				ColorScheme = Colors.Base,
+				ColorScheme = Colors.ColorSchemes ["Base"],
 				Text = "The Text in the Window",
 			};
 			subWinofFV.Add (new TextField ("Edit Me") {
-				ColorScheme = Colors.Error
+				ColorScheme = Colors.ColorSchemes ["Error"]
 			});
 
 			subWinofFV.Add (new CheckBox (0, 1, "Check me"));
@@ -160,7 +160,7 @@ namespace UICatalog.Scenarios {
 				Y = 1,
 				Width = Dim.Percent (100),
 				Height = Dim.Fill () - 1,
-				ColorScheme = Colors.Base,
+				ColorScheme = Colors.ColorSchemes ["Base"],
 				Text = "The Text in the FrameView",
 			};
 			subFrameViewofFV.Add (new TextField (0, 0, 15, "Edit Me"));
@@ -185,7 +185,7 @@ namespace UICatalog.Scenarios {
 			Application.Top.Add (frame);
 			listWin.Add (frame);
 
-			Application.Top.ColorScheme = Colors.Base;
+			Application.Top.ColorScheme = Colors.ColorSchemes ["Base"];
 		}
 	}
 }

+ 3 - 3
UICatalog/Scenarios/Wizards.cs

@@ -14,7 +14,7 @@ namespace UICatalog.Scenarios {
 				X = Pos.Center (),
 				Y = 0,
 				Width = Dim.Percent (75),
-				ColorScheme = Colors.Base,
+				ColorScheme = Colors.ColorSchemes ["Base"],
 			};
 			Win.Add (frame);
 
@@ -86,7 +86,7 @@ namespace UICatalog.Scenarios {
 			var actionLabel = new Label ("") {
 				X = Pos.Right (label),
 				Y = Pos.AnchorEnd (1),
-				ColorScheme = Colors.Error,
+				ColorScheme = Colors.ColorSchemes ["Error"],
 			};
 			Win.Add (actionLabel);
 
@@ -217,7 +217,7 @@ namespace UICatalog.Scenarios {
 						Height = Dim.Fill (1),
 						WordWrap = true,
 						AllowsTab = false,
-						ColorScheme = Colors.Base
+						ColorScheme = Colors.ColorSchemes ["Base"]
 					};
 					var help = "This is helpful.";
 					fourthStep.Add (someText);

+ 2 - 2
UnitTests/Application/ApplicationTests.cs

@@ -490,7 +490,7 @@ public class ApplicationTests {
 			// 0
 			new Attribute (ColorName.White, ColorName.Black),
 			// 1
-			Colors.Base.Normal
+			Colors.ColorSchemes ["Base"].Normal
 		};
 		TestHelpers.AssertDriverAttributesAre (@"
 1111100000
@@ -519,7 +519,7 @@ public class ApplicationTests {
 			// 0
 			new Attribute (ColorName.White, ColorName.Black),
 			// 1
-			Colors.Base.Normal
+			Colors.ColorSchemes ["Base"].Normal
 		};
 		TestHelpers.AssertDriverAttributesAre (@"
 0000000000

+ 17 - 17
UnitTests/Configuration/ConfigurationMangerTests.cs

@@ -331,23 +331,23 @@ public class ConfigurationManagerTests {
 		Settings.Update (json, "TestConfigurationManagerInitDriver");
 
 		var colorSchemes = (Dictionary<string, ColorScheme>)Themes [Themes.Theme] ["ColorSchemes"].PropertyValue;
-		Assert.Equal (Colors.Base, colorSchemes ["Base"]);
-		Assert.Equal (Colors.TopLevel, colorSchemes ["TopLevel"]);
-		Assert.Equal (Colors.Error, colorSchemes ["Error"]);
-		Assert.Equal (Colors.Dialog, colorSchemes ["Dialog"]);
-		Assert.Equal (Colors.Menu, colorSchemes ["Menu"]);
-
-		Colors.Base = colorSchemes ["Base"];
-		Colors.TopLevel = colorSchemes ["TopLevel"];
-		Colors.Error = colorSchemes ["Error"];
-		Colors.Dialog = colorSchemes ["Dialog"];
-		Colors.Menu = colorSchemes ["Menu"];
-
-		Assert.Equal (colorSchemes ["Base"], Colors.Base);
-		Assert.Equal (colorSchemes ["TopLevel"], Colors.TopLevel);
-		Assert.Equal (colorSchemes ["Error"], Colors.Error);
-		Assert.Equal (colorSchemes ["Dialog"], Colors.Dialog);
-		Assert.Equal (colorSchemes ["Menu"], Colors.Menu);
+		Assert.Equal (Colors.ColorSchemes ["Base"], colorSchemes ["Base"]);
+		Assert.Equal (Colors.ColorSchemes ["TopLevel"], colorSchemes ["TopLevel"]);
+		Assert.Equal (Colors.ColorSchemes ["Error"], colorSchemes ["Error"]);
+		Assert.Equal (Colors.ColorSchemes ["Dialog"], colorSchemes ["Dialog"]);
+		Assert.Equal (Colors.ColorSchemes ["Menu"], colorSchemes ["Menu"]);
+
+		Colors.ColorSchemes ["Base"] = colorSchemes ["Base"];
+		Colors.ColorSchemes ["TopLevel"] = colorSchemes ["TopLevel"];
+		Colors.ColorSchemes ["Error"] = colorSchemes ["Error"];
+		Colors.ColorSchemes ["Dialog"] = colorSchemes ["Dialog"];
+		Colors.ColorSchemes ["Menu"] = colorSchemes ["Menu"];
+
+		Assert.Equal (colorSchemes ["Base"], Colors.ColorSchemes ["Base"]);
+		Assert.Equal (colorSchemes ["TopLevel"], Colors.ColorSchemes ["TopLevel"]);
+		Assert.Equal (colorSchemes ["Error"], Colors.ColorSchemes ["Error"]);
+		Assert.Equal (colorSchemes ["Dialog"], Colors.ColorSchemes ["Dialog"]);
+		Assert.Equal (colorSchemes ["Menu"], Colors.ColorSchemes ["Menu"]);
 	}
 
 	[Fact]

+ 8 - 4
UnitTests/Configuration/ThemeTests.cs

@@ -92,7 +92,7 @@ namespace Terminal.Gui.ConfigurationTests {
 				HotFocus = new Attribute (Color.Green, Color.BrightGreen),
 				Disabled = new Attribute (Color.Gray, Color.DarkGray),
 			};
-			theme ["ColorSchemes"].PropertyValue = Colors.Create ();
+			theme ["ColorSchemes"].PropertyValue = Colors.Reset ();
 			((Dictionary<string, ColorScheme>)theme ["ColorSchemes"].PropertyValue) ["test"] = colorScheme;
 
 			var colorSchemes = (Dictionary<string, ColorScheme>)theme ["ColorSchemes"].PropertyValue;
@@ -109,7 +109,7 @@ namespace Terminal.Gui.ConfigurationTests {
 				HotFocus = colorScheme.HotFocus,
 				Disabled = colorScheme.Disabled,
 			};
-			newTheme ["ColorSchemes"].PropertyValue = Colors.Create ();
+			newTheme ["ColorSchemes"].PropertyValue = Colors.Reset ();
 			((Dictionary<string, ColorScheme>)newTheme ["ColorSchemes"].PropertyValue) ["test"] = newColorScheme;
 
 			// Act
@@ -133,7 +133,9 @@ namespace Terminal.Gui.ConfigurationTests {
 			var theme = new ThemeScope ();
 			Assert.NotEmpty (theme);
 
-			theme ["ColorSchemes"].PropertyValue = Colors.Create ();
+			Assert.Equal (5, Colors.ColorSchemes.Count);
+
+			theme ["ColorSchemes"].PropertyValue = Colors.ColorSchemes;
 			var colorSchemes = (Dictionary<string, ColorScheme>)theme ["ColorSchemes"].PropertyValue;
 			Assert.Equal (Colors.ColorSchemes.Count, colorSchemes.Count);
 
@@ -148,7 +150,9 @@ namespace Terminal.Gui.ConfigurationTests {
 				Disabled = new Attribute (Color.Gray, Color.DarkGray),
 			};
 
-			newTheme ["ColorSchemes"].PropertyValue = Colors.Create ();
+			newTheme ["ColorSchemes"].PropertyValue = Colors.Reset ();
+			Assert.Equal (5, Colors.ColorSchemes.Count);
+
 			// add a new ColorScheme to the newTheme
 			((Dictionary<string, ColorScheme>)theme ["ColorSchemes"].PropertyValue) ["test"] = colorScheme;
 

+ 43 - 0
UnitTests/Drawing/ColorSchemeTests.cs

@@ -0,0 +1,43 @@
+using System;
+using System.Linq;
+using Xunit;
+
+namespace Terminal.Gui.DrawingTests;
+
+public class ColorSchemeTests {
+	[Fact]
+	public void Colors_ColorSchemes_Property_Has_Private_Setter ()
+	{
+		// Resharper Code Cleanup likes to remove the `private set; `
+		// from the ColorSchemes property.  This test will fail if
+		// that happens.
+		var property = typeof (Colors).GetProperty ("ColorSchemes");
+		Assert.NotNull (property);
+		Assert.NotNull (property.SetMethod);
+		Assert.True (property.GetSetMethod (true).IsPrivate);
+
+	}
+
+	[Fact]
+	public void ColorScheme_New ()
+	{
+		var scheme = new ColorScheme ();
+		var lbl = new Label ();
+		lbl.ColorScheme = scheme;
+		lbl.Draw ();
+	}
+
+	[Fact]
+	public void Colors_ColorSchemes_Built_Ins ()
+	{
+		Colors.Reset ();
+		var schemes = Colors.ColorSchemes;
+		Assert.NotNull (schemes);
+		Assert.Equal (5, schemes.Count);
+		Assert.True (schemes.ContainsKey ("TopLevel"));
+		Assert.True (schemes.ContainsKey ("Base"));
+		Assert.True (schemes.ContainsKey ("Dialog"));
+		Assert.True (schemes.ContainsKey ("Menu"));
+		Assert.True (schemes.ContainsKey ("Error"));
+	}
+}

+ 0 - 22
UnitTests/Drawing/ColorTests.cs

@@ -10,28 +10,6 @@ public class ColorTests {
 		// prove that Color is a value type
 		Assert.True (typeof (Color).IsValueType);
 
-	[Fact]
-	public void Colors_ColorSchemes_Property_Has_Private_Setter ()
-	{
-		// Resharper Code Cleanup likes to remove the `private set; `
-		// from the ColorSchemes property.  This test will fail if
-		// that happens.
-		var property = typeof (Colors).GetProperty ("ColorSchemes");
-		Assert.NotNull (property);
-		Assert.NotNull (property.SetMethod);
-		Assert.True (property.GetSetMethod (true).IsPrivate);
-
-	}
-
-	[Fact, AutoInitShutdown]
-	public void ColorScheme_New ()
-	{
-		var scheme = new ColorScheme ();
-		var lbl = new Label ();
-		lbl.ColorScheme = scheme;
-		lbl.Draw ();
-	}
-
 	[Fact]
 	public void TestAllColors ()
 	{

+ 13 - 14
UnitTests/TestHelpers.cs

@@ -351,21 +351,20 @@ partial class TestHelpers {
 
 #pragma warning disable xUnit1013 // Public method should be marked as test
 	/// <summary>
-	/// Verifies the console was rendered using the given <paramref name="expectedAttribute"/> at the given locations.
-	/// Pass a bitmap of indexes into <paramref name="expectedAttribute"/> as <paramref name="expectedLook"/> and the
-	/// test method will verify those colors were used in the row/col of the console during rendering
+	/// Verifies <paramref name="expectedAttributes"/> are found at the locations specified by <paramref name="expectedLook"/>.
+	/// <paramref name="expectedLook"/> is a bitmap of indexes into <paramref name="expectedAttributes"/> (e.g. "00110" 
+	/// means the attribute at <c>expectedAttributes[1]</c> is expected at the 3rd and 4th columns of the 1st row of driver.Contents).
 	/// </summary>
 	/// <param name="expectedLook">
-	/// Numbers between 0 and 9 for each row/col of the console.  Must be valid indexes of
-	/// <paramref name="expectedAttribute"/>
+	/// Numbers between 0 and 9 for each row/col of the console.  Must be valid indexes into <paramref name="expectedAttributes"/>.
 	/// </param>
 	/// <param name="driver">The ConsoleDriver to use. If null <see cref="Application.Driver"/> will be used.</param>
-	/// <param name="expectedAttribute"></param>
-	public static void AssertDriverAttributesAre (string expectedLook, ConsoleDriver driver = null, params Attribute [] expectedAttribute)
+	/// <param name="expectedAttributes"></param>
+	public static void AssertDriverAttributesAre (string expectedLook, ConsoleDriver driver = null, params Attribute [] expectedAttributes)
 	{
 #pragma warning restore xUnit1013 // Public method should be marked as test
 
-		if (expectedAttribute.Length > 10) {
+		if (expectedAttributes.Length > 10) {
 			throw new ArgumentException ("This method only works for UIs that use at most 10 colors");
 		}
 
@@ -381,24 +380,24 @@ partial class TestHelpers {
 
 				var val = contents [line, c].Attribute;
 
-				var match = expectedAttribute.Where (e => e == val).ToList ();
+				var match = expectedAttributes.Where (e => e == val).ToList ();
 				switch (match.Count) {
 				case 0:
 					throw new Exception ($"{DriverContentsToString (driver)}\n" +
-					                     $"Expected Attribute {val} at Contents[{line},{c}] {contents [line, c]}' was not found.\n" +
-							     $"  Expected: {string.Join (",", expectedAttribute.Select (c => c))}\n" +
+					                     $"Expected Attribute {val} (PlatformColor = {val.Value.PlatformColor}) at Contents[{line},{c}] {contents [line, c]} ((PlatformColor = {contents [line, c].Attribute.Value.PlatformColor}) was not found.\n" +
+							     $"  Expected: {string.Join (",", expectedAttributes.Select (c => c))}\n" +
 					                     $"  But Was: <not found>");
 				case > 1:
 					throw new ArgumentException ($"Bad value for expectedColors, {match.Count} Attributes had the same Value");
 				}
 
-				var colorUsed = Array.IndexOf (expectedAttribute, match [0]).ToString () [0];
+				var colorUsed = Array.IndexOf (expectedAttributes, match [0]).ToString () [0];
 				var userExpected = lineString [c];
 
 				if (colorUsed != userExpected) {
 					throw new Exception ($"{DriverContentsToString (driver)}\n" +
-						$"Unexpected Attribute at Contents[{line},{c}] {contents [line, c]}.'\n" +
-						$"  Expected: {userExpected} ({expectedAttribute [int.Parse (userExpected.ToString ())]})\n" +
+						$"Unexpected Attribute at Contents[{line},{c}] {contents [line, c]}.\n" +
+						$"  Expected: {userExpected} ({expectedAttributes [int.Parse (userExpected.ToString ())]})\n" +
 						$"  But Was:   {colorUsed} ({val})\n");
 				}
 			}

+ 2 - 2
UnitTests/Text/AutocompleteTests.cs

@@ -46,7 +46,7 @@ namespace Terminal.Gui.TextTests {
 			var tv = new TextView ();
 
 			// to begin with we should be using the default menu color scheme
-			Assert.Same (Colors.Menu, tv.Autocomplete.ColorScheme);
+			Assert.Same (Colors.ColorSchemes ["Menu"], tv.Autocomplete.ColorScheme);
 
 			// allocate a new custom scheme
 			tv.Autocomplete.ColorScheme = new ColorScheme () {
@@ -55,7 +55,7 @@ namespace Terminal.Gui.TextTests {
 			};
 
 			// should be separate instance
-			Assert.NotSame (Colors.Menu, tv.Autocomplete.ColorScheme);
+			Assert.NotSame (Colors.ColorSchemes ["Menu"], tv.Autocomplete.ColorScheme);
 
 			// with the values we set on it
 			Assert.Equal (new Color (Color.Black), tv.Autocomplete.ColorScheme.Normal.Foreground);

+ 5 - 5
UnitTests/UICatalog/ScenarioTests.cs

@@ -217,7 +217,7 @@ public class ScenarioTests {
 			Width = 15,
 			Height = Dim.Fill (1), // for status bar
 			CanFocus = false,
-			ColorScheme = Colors.TopLevel
+			ColorScheme = Colors.ColorSchemes ["TopLevel"]
 		};
 
 		_classListView = new ListView (_viewClasses.Keys.ToList ()) {
@@ -226,7 +226,7 @@ public class ScenarioTests {
 			Width = Dim.Fill (),
 			Height = Dim.Fill (),
 			AllowsMarking = false,
-			ColorScheme = Colors.TopLevel
+			ColorScheme = Colors.ColorSchemes ["TopLevel"]
 		};
 		_leftPane.Add (_classListView);
 
@@ -236,7 +236,7 @@ public class ScenarioTests {
 			Width = Dim.Fill (),
 			Height = 10,
 			CanFocus = false,
-			ColorScheme = Colors.TopLevel
+			ColorScheme = Colors.ColorSchemes ["TopLevel"]
 		};
 		_computedCheckBox = new CheckBox ("Computed Layout", true) { X = 0, Y = 0 };
 		_settingsPane.Add (_computedCheckBox);
@@ -309,7 +309,7 @@ public class ScenarioTests {
 			Y = Pos.Bottom (_settingsPane),
 			Width = Dim.Fill (),
 			Height = Dim.Fill (1), // + 1 for status bar
-			ColorScheme = Colors.Dialog
+			ColorScheme = Colors.ColorSchemes ["Dialog"]
 		};
 
 		_classListView.OpenSelectedItem += (s, a) => {
@@ -524,7 +524,7 @@ public class ScenarioTests {
 
 			// Set the colorscheme to make it stand out if is null by default
 			if (view.ColorScheme == null) {
-				view.ColorScheme = Colors.Base;
+				view.ColorScheme = Colors.ColorSchemes ["Base"];
 			}
 
 			// If the view supports a Text property, set it so we have something to look at

+ 0 - 1
UnitTests/View/Adornment/BorderTests.cs

@@ -687,7 +687,6 @@ public class BorderTests {
 			Normal = new Attribute (Color.Red, Color.Green),
 			Focus = new Attribute (Color.Green, Color.Red),
 		};
-		Assert.Equal (Colors.Error.Normal.Foreground, view.ColorScheme.Normal.Foreground);
 		Assert.Equal (ColorName.Red, view.Border.GetNormalColor ().Foreground.ColorName);
 		Assert.Equal (ColorName.Green, view.Border.GetFocusColor ().Foreground.ColorName);
 		Assert.Equal (view.GetNormalColor(), view.Border.GetNormalColor ());

+ 9 - 9
UnitTests/View/DrawTests.cs

@@ -92,11 +92,11 @@ public class DrawTests {
 
 		var expectedColors = new Attribute [] {
 			// 0
-			Colors.Base.Normal,
+			Colors.ColorSchemes ["Base"].Normal,
 			// 1
-			Colors.Base.Focus,
+			Colors.ColorSchemes ["Base"].Focus,
 			// 2
-			Colors.Base.HotNormal
+			Colors.ColorSchemes ["Base"].HotNormal
 		};
 
 		TestHelpers.AssertDriverAttributesAre (@"
@@ -141,11 +141,11 @@ public class DrawTests {
 
 		var expectedColors = new Attribute [] {
 			// 0
-			Colors.Base.Normal,
+			Colors.ColorSchemes ["Base"].Normal,
 			// 1
-			Colors.Base.Focus,
+			Colors.ColorSchemes ["Base"].Focus,
 			// 2
-			Colors.Base.HotNormal
+			Colors.ColorSchemes ["Base"].HotNormal
 		};
 
 		TestHelpers.AssertDriverAttributesAre (@"
@@ -163,14 +163,14 @@ public class DrawTests {
 			Width = 6,
 			Height = 1,
 			TextAlignment = TextAlignment.Right,
-			ColorScheme = Colors.Base
+			ColorScheme = Colors.ColorSchemes ["Base"]
 		};
 		var labelBottom = new Label ("Test", TextDirection.TopBottom_LeftRight) {
 			Y = 1,
 			Width = 1,
 			Height = 6,
 			VerticalTextAlignment = VerticalTextAlignment.Bottom,
-			ColorScheme = Colors.Base
+			ColorScheme = Colors.ColorSchemes ["Base"]
 		};
 		var top = Application.Top;
 		top.Add (labelRight, labelBottom);
@@ -194,7 +194,7 @@ t     ", _output);
 0
 0
 0
-0", Application.Driver, new Attribute [] { Colors.Base.Normal });
+0", Application.Driver, new Attribute [] { Colors.ColorSchemes ["Base"].Normal });
 	}
 
 	[Fact]

+ 4 - 4
UnitTests/View/Text/AutoSizeTextTests.cs

@@ -1378,7 +1378,7 @@ Y
 
 		// Label is AutoSize == true
 		var label = new Label ("This should be the last line.") {
-			ColorScheme = Colors.Menu,
+			ColorScheme = Colors.ColorSchemes ["Menu"],
 			Width = Dim.Fill (),
 			X = 0, // keep unit test focused; don't use Center here
 			Y = Pos.AnchorEnd (1)
@@ -1422,7 +1422,7 @@ Y
 
 		// Label is AutoSize == true
 		var label = new Label ("This should be the last line.") {
-			ColorScheme = Colors.Menu,
+			ColorScheme = Colors.ColorSchemes ["Menu"],
 			Width = Dim.Fill (),
 			X = 0,
 			Y = Pos.Bottom (win) - 3 // two lines top and bottom borders more one line above the bottom border
@@ -1466,7 +1466,7 @@ Y
 
 		// Label is AutoSize == true
 		var label = new Label ("This should be the last line.") {
-			ColorScheme = Colors.Menu,
+			ColorScheme = Colors.ColorSchemes ["Menu"],
 			Width = Dim.Fill (),
 			X = 0,
 			Y = Pos.Bottom (win) - 4 // two lines top and bottom borders more two lines above border
@@ -1526,7 +1526,7 @@ Y
 
 		// Label is AutoSize == true
 		var label = new Label ("This should be the last line.") {
-			ColorScheme = Colors.Menu,
+			ColorScheme = Colors.ColorSchemes ["Menu"],
 			Width = Dim.Fill (),
 			X = 0,
 			Y = Pos.AnchorEnd (1)

+ 7 - 7
UnitTests/View/ViewTests.cs

@@ -841,7 +841,7 @@ public class ViewTests {
 	[Fact, AutoInitShutdown]
 	public void GetNormalColor_ColorScheme ()
 	{
-		var view = new View { ColorScheme = Colors.Base };
+		var view = new View { ColorScheme = Colors.ColorSchemes ["Base"] };
 
 		Assert.Equal (view.ColorScheme.Normal, view.GetNormalColor ());
 
@@ -853,7 +853,7 @@ public class ViewTests {
 	[Fact, AutoInitShutdown]
 	public void GetHotNormalColor_ColorScheme ()
 	{
-		var view = new View { ColorScheme = Colors.Base };
+		var view = new View { ColorScheme = Colors.ColorSchemes ["Base"] };
 
 		Assert.Equal (view.ColorScheme.HotNormal, view.GetHotNormalColor ());
 
@@ -867,7 +867,7 @@ public class ViewTests {
 	[InlineData (false)]
 	public void Clear_Does_Not_Spillover_Its_Parent (bool label)
 	{
-		var root = new View { Width = 20, Height = 10, ColorScheme = Colors.Base };
+		var root = new View { Width = 20, Height = 10, ColorScheme = Colors.ColorSchemes ["Base"] };
 
 		var v = label ?
 			new Label (new string ('c', 100)) {
@@ -898,9 +898,9 @@ public class ViewTests {
 cccccccccccccccccccc", output);
 
 		var attributes = new [] {
-						Colors.TopLevel.Normal,
-						Colors.Base.Normal,
-						Colors.Base.Focus
+						Colors.ColorSchemes ["TopLevel"].Normal,
+						Colors.ColorSchemes ["Base"].Normal,
+						Colors.ColorSchemes ["Base"].Focus
 					};
 		if (label) {
 			TestHelpers.AssertDriverAttributesAre (@"
@@ -1251,7 +1251,7 @@ At 0,0
 		var frame = new FrameView ();
 
 		var label = new Label ("This should be the first line.") {
-										 ColorScheme = Colors.Menu,
+										 ColorScheme = Colors.ColorSchemes ["Menu"],
 										 Width       = Dim.Fill (),
 										 X           = 0, // don't overcomplicate unit tests
 										 Y           = 0

+ 3 - 3
UnitTests/Views/MenuBarTests.cs

@@ -25,7 +25,7 @@ public class MenuBarTests {
 		var menuBar = new MenuBar ();
 		Assert.Equal (KeyCode.F9, menuBar.Key);
 		var menu = new Menu (menuBar, 0, 0, new MenuBarItem (), null, menuBar.MenusBorderStyle);
-		Assert.Equal (Colors.Menu, menu.ColorScheme);
+		Assert.Equal (Colors.ColorSchemes ["Menu"], menu.ColorScheme);
 		Assert.True (menu.CanFocus);
 		Assert.False (menu.WantContinuousButtonPressed);
 		Assert.Equal (LineStyle.Single, menuBar.MenusBorderStyle);
@@ -36,7 +36,7 @@ public class MenuBarTests {
 		Assert.IsType<Dim.DimFill> (menuBar.Width);
 		Assert.Equal (1, menuBar.Height);
 		Assert.Empty (menuBar.Menus);
-		Assert.Equal (Colors.Menu, menuBar.ColorScheme);
+		Assert.Equal (Colors.ColorSchemes ["Menu"], menuBar.ColorScheme);
 		Assert.True (menuBar.WantMousePositionReports);
 		Assert.False (menuBar.IsMenuOpen);
 
@@ -46,7 +46,7 @@ public class MenuBarTests {
 		Assert.IsType<Dim.DimFill> (menuBar.Width);
 		Assert.Equal (1, menuBar.Height);
 		Assert.Empty (menuBar.Menus);
-		Assert.Equal (Colors.Menu, menuBar.ColorScheme);
+		Assert.Equal (Colors.ColorSchemes ["Menu"], menuBar.ColorScheme);
 		Assert.True (menuBar.WantMousePositionReports);
 		Assert.False (menuBar.IsMenuOpen);
 

+ 2 - 2
UnitTests/Views/OverlappedTests.cs

@@ -704,9 +704,9 @@ public class OverlappedTests {
  └───┘", _output);
 		var attributes = new [] {
 			// 0
-			Colors.TopLevel.Normal,
+			Colors.ColorSchemes ["TopLevel"].Normal,
 			// 1
-			Colors.Base.Normal
+			Colors.ColorSchemes ["Base"].Normal
 		};
 		TestHelpers.AssertDriverAttributesAre (@"
 0000000000

+ 1 - 1
UnitTests/Views/ProgressBarTests.cs

@@ -15,7 +15,7 @@ namespace Terminal.Gui.ViewsTests {
 			Assert.Equal (0, pb.Fraction);
 			Assert.Equal (new Attribute (Color.BrightGreen, Color.Gray),
 				new Attribute (pb.ColorScheme.HotNormal.Foreground, pb.ColorScheme.HotNormal.Background));
-			Assert.Equal (Colors.Base.Normal, pb.ColorScheme.Normal);
+			Assert.Equal (Colors.ColorSchemes ["Base"].Normal, pb.ColorScheme.Normal);
 			Assert.Equal (1, pb.Height);
 			Assert.Equal (ProgressBarStyle.Blocks, pb.ProgressBarStyle);
 			Assert.Equal (ProgressBarFormat.Simple, pb.ProgressBarFormat);

+ 5 - 5
UnitTests/Views/RuneCellTests.cs

@@ -103,15 +103,15 @@ Error   ";
 
 			var attributes = new Attribute [] {
 				// 0
-				Colors.TopLevel.Focus,
+				Colors.ColorSchemes ["TopLevel"].Focus,
 				// 1
-				Colors.Base.Focus,
+				Colors.ColorSchemes ["Base"].Focus,
 				// 2
-				Colors.Dialog.Focus,
+				Colors.ColorSchemes ["Dialog"].Focus,
 				// 3
-				Colors.Menu.Focus,
+				Colors.ColorSchemes ["Menu"].Focus,
 				// 4
-				Colors.Error.Focus
+				Colors.ColorSchemes ["Error"].Focus
 			};
 			var expectedColor = @"
 0000000000

+ 3 - 3
UnitTests/Views/ScrollViewTests.cs

@@ -498,9 +498,9 @@ namespace Terminal.Gui.ViewsTests {
                At 15,15", output);
 
 			var attributes = new Attribute [] {
-						Colors.TopLevel.Normal,
-						Colors.TopLevel.Focus,
-						Colors.Base.Normal
+						Colors.ColorSchemes ["TopLevel"].Normal,
+						Colors.ColorSchemes ["TopLevel"].Focus,
+						Colors.ColorSchemes ["Base"].Normal
 					};
 
 			TestHelpers.AssertDriverAttributesAre (@"

+ 1 - 1
UnitTests/Views/StatusBarTests.cs

@@ -31,7 +31,7 @@ namespace Terminal.Gui.ViewsTests {
 
 			Assert.Empty (sb.Items);
 			Assert.False (sb.CanFocus);
-			Assert.Equal (Colors.Menu, sb.ColorScheme);
+			Assert.Equal (Colors.ColorSchemes ["Menu"], sb.ColorScheme);
 			Assert.Equal (0, sb.X);
 			Assert.Equal ("AnchorEnd(1)", sb.Y.ToString ());
 			Assert.Equal (Dim.Fill (), sb.Width);

+ 57 - 49
UnitTests/Views/TableViewTests.cs

@@ -11,6 +11,7 @@ using System.Reflection;
 using Terminal.Gui.ViewTests;
 using System.Collections;
 using static Terminal.Gui.SpinnerStyle;
+using static System.Runtime.InteropServices.JavaScript.JSType;
 
 namespace Terminal.Gui.ViewsTests {
 
@@ -159,7 +160,7 @@ namespace Terminal.Gui.ViewsTests {
 			Assert.Equal (11, "hello there".EnumerateRunes ().Sum (c => c.GetColumns ()));
 
 			// Creates a string with the peculiar (french?) r symbol
-			String surrogate = "Les Mise" + Char.ConvertFromUtf32 (Int32.Parse ("0301", NumberStyles.HexNumber)) + "rables";
+			var surrogate = "Les Mise" + Char.ConvertFromUtf32 (Int32.Parse ("0301", NumberStyles.HexNumber)) + "rables";
 
 			// The unicode width of this string is shorter than the string length! 
 			Assert.Equal (14, surrogate.EnumerateRunes ().Sum (c => c.GetColumns ()));
@@ -907,7 +908,7 @@ namespace Terminal.Gui.ViewsTests {
 				Normal = new Attribute (Color.BrightCyan, Color.DarkGray),
 				HotNormal = new Attribute (Color.Green, Color.Blue),
 				Focus = new Attribute (Color.BrightYellow, Color.White),
-				
+
 				// Not used by TableView
 				HotFocus = new Attribute (Color.Cyan, Color.Magenta),
 			};
@@ -1000,7 +1001,7 @@ namespace Terminal.Gui.ViewsTests {
 				Normal = new Attribute (Color.BrightCyan, Color.DarkGray),
 				HotNormal = new Attribute (Color.Green, Color.Blue),
 				Focus = new Attribute (Color.Cyan, Color.Magenta),
-				
+
 				// Not used by TableView
 				HotFocus = new Attribute (Color.BrightYellow, Color.White),
 			};
@@ -1094,7 +1095,7 @@ namespace Terminal.Gui.ViewsTests {
 			tv.Style.GetOrCreateColumnStyle (1).MaxWidth = 1;
 			tv.Style.GetOrCreateColumnStyle (1).MaxWidth = 1;
 
-			tv.ColorScheme = Colors.Base;
+			tv.ColorScheme = Colors.ColorSchemes ["Base"];
 			return tv;
 		}
 
@@ -1132,7 +1133,7 @@ namespace Terminal.Gui.ViewsTests {
 			var tableView = new TableView ();
 			tableView.BeginInit (); tableView.EndInit ();
 
-			tableView.ColorScheme = Colors.TopLevel;
+			tableView.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 			tableView.LayoutSubviews ();
 
 			// 3 columns are visibile
@@ -1194,7 +1195,7 @@ namespace Terminal.Gui.ViewsTests {
 		{
 			var tableView = new TableView ();
 			tableView.BeginInit (); tableView.EndInit ();
-			tableView.ColorScheme = Colors.TopLevel;
+			tableView.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 
 			// 3 columns are visibile
 			tableView.Bounds = new Rect (0, 0, 7, 5);
@@ -1254,7 +1255,7 @@ namespace Terminal.Gui.ViewsTests {
 			var tableView = new TableView ();
 			tableView.BeginInit (); tableView.EndInit ();
 
-			tableView.ColorScheme = Colors.TopLevel;
+			tableView.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 
 			// 3 columns are visible
 			tableView.Bounds = new Rect (0, 0, 7, 5);
@@ -1803,7 +1804,7 @@ namespace Terminal.Gui.ViewsTests {
 			Application.Top.Add (tableView);
 			Application.Begin (Application.Top);
 
-			tableView.ColorScheme = Colors.TopLevel;
+			tableView.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 
 			// 25 characters can be printed into table
 			tableView.Bounds = new Rect (0, 0, 25, 5);
@@ -1980,7 +1981,7 @@ namespace Terminal.Gui.ViewsTests {
 			var tableView = new TableView ();
 			tableView.BeginInit (); tableView.EndInit ();
 
-			tableView.ColorScheme = Colors.TopLevel;
+			tableView.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 
 			// 3 columns are visibile
 			tableView.Bounds = new Rect (0, 0, 7, 5);
@@ -2123,7 +2124,7 @@ namespace Terminal.Gui.ViewsTests {
 			var tableView = GetABCDEFTableView (out _);
 			tableView.BeginInit (); tableView.EndInit ();
 
-			tableView.ColorScheme = Colors.TopLevel;
+			tableView.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 
 			// 3 columns are visibile
 			tableView.Bounds = new Rect (0, 0, 7, 5);
@@ -2152,7 +2153,7 @@ namespace Terminal.Gui.ViewsTests {
 			var tableView = GetABCDEFTableView (out _);
 			tableView.BeginInit (); tableView.EndInit ();
 
-			tableView.ColorScheme = Colors.TopLevel;
+			tableView.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 
 			// 3 columns are visibile
 			tableView.Bounds = new Rect (0, 0, 7, 5);
@@ -2216,7 +2217,11 @@ namespace Terminal.Gui.ViewsTests {
 			TestHelpers.AssertDriverContentsAre (expected, output);
 
 			var normal = tv.ColorScheme.Normal;
-			var focus = tv.ColorScheme.Focus = new Attribute (Color.Magenta, Color.White);
+			tv.ColorScheme = new ColorScheme (tv.ColorScheme) {
+				Focus = new Attribute (Color.Magenta, Color.White)
+			};
+			var focus = tv.ColorScheme.Focus;
+
 
 			tv.Draw ();
 
@@ -2274,7 +2279,10 @@ namespace Terminal.Gui.ViewsTests {
 			TestHelpers.AssertDriverContentsAre (expected, output);
 
 			var normal = tv.ColorScheme.Normal;
-			var focus = tv.ColorScheme.Focus = new Attribute (Color.Magenta, Color.White);
+			tv.ColorScheme = new ColorScheme (tv.ColorScheme) {
+				Focus = new Attribute (Color.Magenta, Color.White)
+			};
+			var focus = tv.ColorScheme.Focus;
 
 			tv.Draw ();
 
@@ -2293,7 +2301,7 @@ namespace Terminal.Gui.ViewsTests {
 		}
 
 		[Fact, AutoInitShutdown]
-		public void TestTableViewCheckboxes_Simple()
+		public void TestTableViewCheckboxes_Simple ()
 		{
 
 			var tv = GetTwoRowSixColumnTable (out var dt);
@@ -2323,7 +2331,7 @@ namespace Terminal.Gui.ViewsTests {
 
 			Assert.Single (wrapper.CheckedRows, 0);
 
-			tv.Draw();
+			tv.Draw ();
 
 			expected =
 				@"
@@ -2339,12 +2347,12 @@ namespace Terminal.Gui.ViewsTests {
 			tv.NewKeyDownEvent (new (KeyCode.Space));
 
 
-			Assert.Contains (0,wrapper.CheckedRows);
-			Assert.Contains (1,wrapper.CheckedRows);
+			Assert.Contains (0, wrapper.CheckedRows);
+			Assert.Contains (1, wrapper.CheckedRows);
 			Assert.Equal (2, wrapper.CheckedRows.Count);
 
 
-			tv.Draw();
+			tv.Draw ();
 
 			expected =
 				@"
@@ -2362,7 +2370,7 @@ namespace Terminal.Gui.ViewsTests {
 
 			Assert.Single (wrapper.CheckedRows, 1);
 
-			tv.Draw();
+			tv.Draw ();
 
 			expected =
 				@"
@@ -2390,7 +2398,7 @@ namespace Terminal.Gui.ViewsTests {
 			tv.NewKeyDownEvent (new (KeyCode.A | KeyCode.CtrlMask));
 			tv.NewKeyDownEvent (new (KeyCode.Space));
 
-			tv.Draw();
+			tv.Draw ();
 
 			string expected =
 				@"
@@ -2409,7 +2417,7 @@ namespace Terminal.Gui.ViewsTests {
 			// Untoggle all again
 			tv.NewKeyDownEvent (new (KeyCode.Space));
 
-			tv.Draw();
+			tv.Draw ();
 
 			expected =
 				@"
@@ -2436,7 +2444,7 @@ namespace Terminal.Gui.ViewsTests {
 			wrapper.CheckedRows.Add (0);
 			wrapper.CheckedRows.Add (2);
 
-			tv.Draw();
+			tv.Draw ();
 
 			string expected =
 				@"
@@ -2458,7 +2466,7 @@ namespace Terminal.Gui.ViewsTests {
 			Assert.Contains (2, wrapper.CheckedRows);
 			Assert.Equal (3, wrapper.CheckedRows.Count);
 
-			tv.Draw();
+			tv.Draw ();
 
 			expected =
 				@"
@@ -2473,7 +2481,7 @@ namespace Terminal.Gui.ViewsTests {
 			// Untoggle the top 2
 			tv.NewKeyDownEvent (new (KeyCode.Space));
 
-			tv.Draw();
+			tv.Draw ();
 
 			expected =
 				@"
@@ -2494,15 +2502,15 @@ namespace Terminal.Gui.ViewsTests {
 			tv.LayoutSubviews ();
 			var pets = source.Data;
 
-			var wrapper = new CheckBoxTableSourceWrapperByObject<PickablePet>(
+			var wrapper = new CheckBoxTableSourceWrapperByObject<PickablePet> (
 				tv,
 				source,
-				(p)=>p.IsPicked,
-				(p,b)=>p.IsPicked = b);
+				(p) => p.IsPicked,
+				(p, b) => p.IsPicked = b);
 
 			tv.Table = wrapper;
 
-			tv.Draw();
+			tv.Draw ();
 
 			string expected =
 				@"
@@ -2515,13 +2523,13 @@ namespace Terminal.Gui.ViewsTests {
 
 			TestHelpers.AssertDriverContentsAre (expected, output);
 
-			Assert.Empty (pets.Where(p=>p.IsPicked));
+			Assert.Empty (pets.Where (p => p.IsPicked));
 
 			tv.NewKeyDownEvent (new (KeyCode.Space));
-			
+
 			Assert.True (pets.First ().IsPicked);
 
-			tv.Draw();
+			tv.Draw ();
 
 			expected =
 				@"
@@ -2538,11 +2546,11 @@ namespace Terminal.Gui.ViewsTests {
 			tv.NewKeyDownEvent (new (KeyCode.CursorDown));
 			tv.NewKeyDownEvent (new (KeyCode.Space));
 
-			Assert.True (pets.ElementAt(0).IsPicked);
+			Assert.True (pets.ElementAt (0).IsPicked);
 			Assert.True (pets.ElementAt (1).IsPicked);
 			Assert.False (pets.ElementAt (2).IsPicked);
 
-			tv.Draw();
+			tv.Draw ();
 
 			expected =
 				@"
@@ -2564,7 +2572,7 @@ namespace Terminal.Gui.ViewsTests {
 			Assert.True (pets.ElementAt (1).IsPicked);
 			Assert.False (pets.ElementAt (2).IsPicked);
 
-			tv.Draw();
+			tv.Draw ();
 
 			expected =
 				@"
@@ -2604,7 +2612,7 @@ namespace Terminal.Gui.ViewsTests {
 
 			Assert.True (pets.All (p => p.IsPicked));
 
-			tv.Draw();
+			tv.Draw ();
 
 			string expected =
 				@"
@@ -2622,7 +2630,7 @@ namespace Terminal.Gui.ViewsTests {
 
 			Assert.Empty (pets.Where (p => p.IsPicked));
 
-			tv.Draw();
+			tv.Draw ();
 
 			expected =
 				@"
@@ -2654,7 +2662,7 @@ namespace Terminal.Gui.ViewsTests {
 			wrapper.UseRadioButtons = true;
 
 			tv.Table = wrapper;
-			tv.Draw();
+			tv.Draw ();
 
 			string expected =
 				@"
@@ -2674,7 +2682,7 @@ namespace Terminal.Gui.ViewsTests {
 
 			Assert.True (pets.First ().IsPicked);
 
-			tv.Draw();
+			tv.Draw ();
 
 			expected =
 				@"
@@ -2695,7 +2703,7 @@ namespace Terminal.Gui.ViewsTests {
 			Assert.True (pets.ElementAt (1).IsPicked);
 			Assert.False (pets.ElementAt (2).IsPicked);
 
-			tv.Draw();
+			tv.Draw ();
 
 			expected =
 				@"
@@ -2717,7 +2725,7 @@ namespace Terminal.Gui.ViewsTests {
 			Assert.False (pets.ElementAt (1).IsPicked);
 			Assert.False (pets.ElementAt (2).IsPicked);
 
-			tv.Draw();
+			tv.Draw ();
 
 			expected =
 				@"
@@ -2769,8 +2777,8 @@ A B C
 			TestHelpers.AssertDriverContentsAre (expected, output);
 
 			var normal = tv.ColorScheme.Normal;
-			var focus = tv.ColorScheme.Focus = new Attribute (Color.Magenta, Color.White);
-
+			tv.ColorScheme = new ColorScheme (tv.ColorScheme) { Focus = new Attribute (Color.Magenta, Color.White) };
+			var focus = tv.ColorScheme.Focus;
 			tv.Draw ();
 
 			// Focus color (1) should be used for rendering the selected line
@@ -2995,7 +3003,7 @@ A B C
 
 			var tv = new TableView ();
 			//tv.BeginInit (); tv.EndInit ();
-			tv.ColorScheme = Colors.TopLevel;
+			tv.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 			tv.Bounds = new Rect (0, 0, 25, 4);
 			tv.Style = new () {
 				ShowHeaders = false,
@@ -3063,7 +3071,7 @@ A B C
 		public void TestEnumerableDataSource_BasicTypes ()
 		{
 			var tv = new TableView ();
-			tv.ColorScheme = Colors.TopLevel;
+			tv.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 			tv.Bounds = new Rect (0, 0, 50, 6);
 
 			tv.Table = new EnumerableTableSource<Type> (
@@ -3093,7 +3101,7 @@ A B C
 		public void Test_CollectionNavigator ()
 		{
 			var tv = new TableView ();
-			tv.ColorScheme = Colors.TopLevel;
+			tv.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 			tv.Bounds = new Rect (0, 0, 50, 7);
 
 			tv.Table = new EnumerableTableSource<string> (
@@ -3161,7 +3169,7 @@ A B C
 			tv.NewKeyDownEvent (new Key () { KeyCode = KeyCode.CursorRight });
 			Assert.Equal (1, tv.SelectedColumn);
 			Assert.Equal (2, tv.SelectedRow);
-			
+
 			// nothing ends with t so stay where you are
 			tv.NewKeyDownEvent (new Key () { KeyCode = KeyCode.T });
 			Assert.Equal (2, tv.SelectedRow);
@@ -3183,7 +3191,7 @@ A B C
 		private TableView GetTwoRowSixColumnTable (out DataTable dt)
 		{
 			var tableView = new TableView ();
-			tableView.ColorScheme = Colors.TopLevel;
+			tableView.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 
 			// 3 columns are visible
 			tableView.Bounds = new Rect (0, 0, 7, 5);
@@ -3210,7 +3218,7 @@ A B C
 
 		private class PickablePet {
 			public bool IsPicked { get; set; }
-			public string Name{ get; set; }
+			public string Name { get; set; }
 			public string Kind { get; set; }
 
 			public PickablePet (bool isPicked, string name, string kind)
@@ -3224,7 +3232,7 @@ A B C
 		private TableView GetPetTable (out EnumerableTableSource<PickablePet> source)
 		{
 			var tv = new TableView ();
-			tv.ColorScheme = Colors.TopLevel;
+			tv.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 			tv.Bounds = new Rect (0, 0, 25, 6);
 
 			var pets = new List<PickablePet> {

+ 1 - 1
UnitTests/Views/TextFieldTests.cs

@@ -30,7 +30,7 @@ public class TextFieldTests {
 			//                                                    1         2         3 
 			//                                          01234567890123456789012345678901=32 (Length)
 			TextFieldTests._textField = new TextField ("TAB to jump between text fields.") {
-				ColorScheme = Colors.Base
+				ColorScheme = Colors.ColorSchemes ["Base"]
 			};
 		}
 

+ 1 - 1
UnitTests/Views/TextViewTests.cs

@@ -37,7 +37,7 @@ public class TextViewTests {
 			//         01234567890123456789012345678901=32 (Length)
 			var buff = Encoding.Unicode.GetBytes (txt);
 			var ms = new System.IO.MemoryStream (buff).ToArray ();
-			_textView = new TextView () { Width = 30, Height = 10, ColorScheme = Colors.Base };
+			_textView = new TextView () { Width = 30, Height = 10, ColorScheme = Colors.ColorSchemes ["Base"] };
 			_textView.Text = Encoding.Unicode.GetString (ms);
 		}
 

+ 1 - 1
UnitTests/Views/ToplevelTests.cs

@@ -15,7 +15,7 @@ public class ToplevelTests {
 	{
 		var top = new Toplevel ();
 
-		Assert.Equal (Colors.TopLevel, top.ColorScheme);
+		Assert.Equal (Colors.ColorSchemes ["TopLevel"], top.ColorScheme);
 		Assert.Equal ("Fill(0)", top.Width.ToString ());
 		Assert.Equal ("Fill(0)", top.Height.ToString ());
 		Assert.False (top.Running);

+ 2 - 2
UnitTests/Views/TreeTableSourceTests.cs

@@ -240,8 +240,8 @@ public class TreeTableSourceTests: IDisposable {
 	private TableView GetTreeTable (out TreeView<IDescribedThing> tree)
 	{
 		var tableView = new TableView ();
-		tableView.ColorScheme = Colors.TopLevel;
-		tableView.ColorScheme = Colors.TopLevel;
+		tableView.ColorScheme = Colors.ColorSchemes ["TopLevel"];
+		tableView.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 		tableView.Bounds = new Rect (0, 0, 40, 6);
 
 		tableView.Style.ShowHorizontalHeaderUnderline = true;