NamedColour

References
public sealed class NamedColour : IStorable
A (mostly) immutable named colour.

Constructors

NamedColour

#
public NamedColour(IReader reader)
Deserialization constructor
reader (IReader)

NamedColour

#
public NamedColour(string name, Color colour, IEnumerable<string> alternates = null, IEnumerable<string> adjectives = null, ColourImportance importance = ColourImportance.Primary, string source = null, string footnote = null)
Create a new linguistic colour.
name (string)Name of colour.
colour (Color)Colour.
alternates (IEnumerable<string> = null)Optional alternate spellings.
adjectives (IEnumerable<string> = null)Optional adjectives.
importance (ColourImportance = ColourImportance.Primary)Importance.
source (string = null)Source.
footnote (string = null)Footnote.

NamedColour

#
public NamedColour(string names, string adjectives, Color colour, ColourImportance importance = ColourImportance.Primary, string source = null, string footnote = null)
Create a new linguistic colour entity.
names (string)Names of colour (comma separated). First entry is the official name.
adjectives (string)Optional adjectives of colour (comma separated).
colour (Color)Colour. Alpha channel values are ignored.
importance (ColourImportance = ColourImportance.Primary)Linguistic importance.
source (string = null)Optional entity source. For example name of standard.
footnote (string = null)Optional footnote.

Properties

Adjectives

#
public IEnumerable<string> Adjectives { get; }
Gets the adjective associated with this entity. I.e. "reddish", or "blackish".

Alternates

#
public IEnumerable<string> Alternates { get; }
Gets all the different spellings associated with this colour. The first spelling is identical to the 'official' name, subsequent entries are considered alternate spellings (i.e. "grey" and "gray").

Colour

#
public Color Colour { get; }
Gets the colour associated with this entity.

Footnote

#
public string Footnote { get; }
Gets the author comments associated with this entity.

Importance

#
public ColourImportance Importance { get; set; }
Gets or sets the linguistic importance of this colour. This is the only mutable property of this type, a pattern forced upon me by the Eto controls.

Name

#
public string Name { get; }
Gets the name associated with this entity.

Source

#
public string Source { get; }
Gets the category under which this entity is grouped.

Timestamp

#
public DateTime Timestamp { get; }
Gets the timestamp for when this colour was created.

Methods

FromString

#
public static NamedColour FromString(string line)
Parse a string as a linguistic colour entity. The format must be the same as the result of the ToString() method. This method throws exceptions if the format is not valid.
line (string)Line to parse.
Linguistic colour.

Store

#
public void Store(IWriter writer)
This method is called whenever the instance is required to serialize itself.
writer (IWriter)Writer object to serialize with.
Store

ToAdjectivesString

#
public string ToAdjectivesString()
Create a name string including all alternate spellings.

ToNamesString

#
public string ToNamesString()
Create a name string including all alternate spellings.

ToString

#
public override string ToString()
Returns a string that represents the current object.
A string that represents the current object.
Object.ToString

TryMerge

#
public static NamedColour TryMerge(params NamedColour[] colours)
Attempt to losslessly merge two colours. For two colours to be mergeable they must have the same name and the exact same colour. Alternate names, adjectives, sources and footnotes will be combined.
colours (params NamedColour[])Colours to merge.
Lossless combination.