#nullable enable
using System.Text.Json.Serialization;
namespace Terminal.Gui;
///
/// Holds the s that define the s that are used by views to render
/// themselves.
///
public static class Colors
{
static Colors ()
{
ColorSchemes = new (5, StringComparer.InvariantCultureIgnoreCase);
Reset ();
}
/// Gets a dictionary of defined objects.
///
///
/// The dictionary includes the following keys, by default:
///
///
/// Built-in Color Scheme Description
///
/// -
/// Base The base color scheme used for most Views.
///
/// -
/// TopLevel
/// The application Toplevel color scheme; used for the View.
///
/// -
/// Dialog
///
/// The dialog color scheme; used for , , and
/// other views dialog-like views.
///
///
/// -
/// Menu
///
/// The menu color scheme; used for , , and
/// .
///
///
/// -
/// Error
///
/// The color scheme for showing errors, such as in
/// .
///
///
///
///
/// Changing the values of an entry in this dictionary will affect all views that use the scheme.
///
/// can be used to override the default values for these schemes and add
/// additional schemes. See .
///
///
[SerializableConfigurationProperty (Scope = typeof (ThemeScope), OmitClassName = true)]
[JsonConverter (typeof (DictionaryJsonConverter))]
public static Dictionary ColorSchemes { get; private set; }
/// Resets the dictionary to the default values.
public static Dictionary Reset ()
{
ColorSchemes.Clear ();
ColorSchemes.Add ("TopLevel", new ());
ColorSchemes.Add ("Base", new ());
ColorSchemes.Add ("Dialog", new ());
ColorSchemes.Add ("Menu", new ());
ColorSchemes.Add ("Error", new ());
return ColorSchemes;
}
}