Class NamedColorCollection
A collection of named colors
Inherited Members
Namespace: SadConsole.UI
Assembly: SadConsole.dll
Syntax
public class NamedColorCollection : IEnumerable<NamedColor>, IEnumerable
Constructors
NamedColorCollection()
Creates a new instance with the default colors of White and Black.
Declaration
public NamedColorCollection()
Properties
Colors
The backing dictionary of colors.
Declaration
public Dictionary<string, NamedColor> Colors { get; set; }
Property Value
Type | Description |
---|---|
Dictionary<string, NamedColor> |
Methods
Add(NamedColor)
Adds a color to the collection.
Declaration
public void Add(NamedColor color)
Parameters
Type | Name | Description |
---|---|---|
NamedColor | color |
GetEnumerator()
Declaration
public IEnumerator<NamedColor> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<NamedColor> |
Load(string)
Loads a Colors dictionary from a file, and returns a new instance of the NamedColorCollection class with those colors.
Declaration
public static NamedColorCollection Load(string file)
Parameters
Type | Name | Description |
---|---|---|
string | file | The file. |
Returns
Type | Description |
---|---|
NamedColorCollection |
Exceptions
Type | Condition |
---|---|
FileNotFoundException | Thrown when the file isn't found. |
LoadDefaults()
Clears the collection of colors and adds White and Black colors.
Declaration
public void LoadDefaults()
Save(string)
Saves the Colors dictionary to a file.
Declaration
public void Save(string file)
Parameters
Type | Name | Description |
---|---|---|
string | file | The file. |