NamedPalette
ReferencesRepresents a collection of uniquely named colours. Think of this as a colour dictionary.
Constructors
NamedPalette
#Create a new populated palette.
Parameters:
| colours (IEnumerable<NamedColour>) | Collection of colours. All names must be unique. |
Fields
Properties
EmptyPalette
#Create an 'empty' palette containing only Black and White.
Returns: Palette with the only colours *everyone* can agree on.
StandardCorePalette
#Create the standard Grasshopper colour palette containing only the principal colours.
StandardFullPalette
#Create the standard Grasshopper colour palette, including all secondary colours.
X11Palette
#Create a palette containing the standard web palette.
Returns: Colour palette based on the X11 palette.
Methods
Add
#Add a colour to this palette.
Parameters:
| colour (NamedColour) | Colour to add. |
Returns: Modified palette.
AddToRhinoDocument
#Insert this palette into a Rhino document as a set of dots.
Parameters:
| doc (RhinoDoc) | Document. |
Returns: Array of guids of added objects.
CanReplace
#Resolve whether a specific name can be replaced with another without name collisions. If the oldName hasn't been defined yet, replacement is considered to be possible.
Compose
#Compose a colour based on some textual description.
Parameters:
| description (string) | Description of a colour. |
| result (out Color) | Resulting colour. |
Returns: Level of confidence in the result.
Describe
#Describe a colour as the most similar named colour.
Parameters:
| colour (Color) | Colour to describe. |
| deviation (out string) | Description of deviation. |
Returns: Colour name.
Describe
#Describe a colour as the most similar named colour.
Parameters:
| colour (Color) | Colour to describe. |
Returns: Name of most similar colour, with a tilde prefix if the named colour differs significantly.
FilterImportance
#Create a new palette containing only the colours that match the given importance.
Parameters:
| importance (ColourImportance) |
Find
#Find the colour closest to the given one.
Parameters:
| colour (Color) | Colour locus. |
| deviation (out double) | Deviation between source and target colour measured in the CIE delta-E metric. |
Returns: Colour closest to the given one.
Find
#Find the colour closest to the given one.
Parameters:
| colour (Color) | Colour locus. |
Returns: Colour closest to the given one.
Find
#Find the colour associated with the specified name.
Parameters:
| name (string) | Name of colour to search for. |
Returns: Colour associated with name or null.
FindIdentical
#Find all identical colours.
Parameters:
| colour (Color) | Base colour. |
Returns: All identical colours, sorted from most similar to least similar.
FindSimilar
#Find all similar colours (but not any identical colours).
Parameters:
| colour (Color) | Base colour. |
| maxDeviation (double) | Threshold for similarity. This distance is measured within a vertically aligned sinusoidal volume with black at (0,0-1) and white at (0,0,+1). Hue is mapped around the central axis and saturation and luminance together control the offset from the central axis, which is at most 0.5 around the equator. The largest possible distance between any two colours is 2.0, between black and white. |
| maxCount (int) | Maximum number of results to return. |
Returns: All similar colours, sorted from most similar to least similar.
ImpliedPalette
#Gets the palette implied by the name. If no matching palette can be found, null will be returned.
Parameters:
| name (string) | Name to search for. |
Merge
#Merge a collection of palettes.
Parameters:
| mergeFunction (NamedPalette.MergeDelegate) | Merge function used in case of name collisions. |
| palettes (params NamedPalette[]) | Dictionaries to merge. |
Returns: Merged palette.
Merge
#Merge a collection of palettes.
Parameters:
| behaviour (PaletteMergeBehaviour) | One of the preset merge behaviours. |
| palettes (params NamedPalette[]) | Dictionaries to merge. Colliding names are omitted from later palettes. |
Returns: Merged palette.
ReadFromStrings
#Deserialize a colour palette from an array of strings.
Parameters:
| entries (string[]) | Strings to parse. |
Returns: Palette.
Remove
#Remove a colour from this palette.
Parameters:
| name (string) | Name of colour to remove. |
Returns: Modified palette.
Replace
#Replace a colour in this palette.
Parameters:
| oldColour (NamedColour) | Colour to remove. |
| newColour (NamedColour) | Colour to insert. |
Returns: Modified palette.
Replace
#Replace a colour in this palette.
Parameters:
| oldColourName (string) | Name of colour to remove. |
| newColour (NamedColour) | Colour to insert. |
Returns: Modified palette.
ToString
#Returns a string that represents the current object.
Returns: A string that represents the current object.
Overrides: Object.ToString
WriteToFile
#Write a palette to a file.
Parameters:
| file (string) | File path. |
| palette (NamedPalette) | Palette to write. |
WriteToStrings
#Serialize this palette to an array of strings.
Parameters:
| palette (NamedPalette) |
Returns: Array of strings.