SkinServer

public static class SkinServer
The skins folder and everything that touches it. A skin is a text definition in Folders.SkinsFolder, and its name is its file name; the canvas picks a skin by that name through Settings.CanvasSkin, with an empty name meaning the built-in default. Files may be imported from and exported to anywhere. The skins shipped with Grasshopper, other than the default, are copied into the folder the first time it is used, and from then on are files like any other.

Fields

DefaultName

#
public const string DefaultName = "Default"
The name shown for the built-in skin, which no file may take.

Extension

#
public const string Extension = ".ghskin"

Properties

Current

#
public static string Current { get; }
The name of the skin the canvas uses, or empty for the built-in default.

CurrentSkin

#
public static Skin CurrentSkin { get; }
The current skin for the current dark mode setting.

Dim

#
public static Skin Dim { get; }
The current skin in dark mode.

Lit

#
public static Skin Lit { get; }
The current skin in bright mode: the chosen definition evaluated, or the built-in skin. This is what every canvas, preview and thumbnail draws with unless it is given a skin.

Methods

Delete

#
public static bool Delete(string name)
Delete a stored skin. The canvas reverts to the default if it was using it.
name (string)

Exists

#
public static bool Exists(string name)
name (string)

Export

#
public static void Export(SkinDefinition definition, string path)
definition (SkinDefinition)
path (string)

Import

#
public static bool Import(string path, bool overwrite, out string name)
Copy a skin file into the folder under its own file name.
path (string)File to import.
overwrite (bool)Whether an existing skin of that name may be replaced.
name (out string)The name the skin was stored under.
False when the file is not a valid skin name, or the name is taken and overwriting is not allowed.

IsCurrent

#
public static bool IsCurrent(string name)
name (string)

IsValidName

#
public static bool IsValidName(string name)
A name is valid when it can be a file name and is not the reserved default.
name (string)

Load

#
public static SkinDefinition Load(string name, out string[] errors)
Load a stored skin. Faulty lines are skipped and reported.
name (string)
errors (out string[])

LoadCurrent

#
public static SkinDefinition LoadCurrent()
The definition the canvas should use, or null for the built-in skins. A missing or faulty file is logged and treated as the default.

Names

#
public static string[] Names()
The names of every stored skin, sorted.

NamesAndInfos

#
public static (string name, string info, string author)[] NamesAndInfos()
The names, infos and authors of every stored skin, sorted by name.

PathOf

#
public static string PathOf(string name)
name (string)

Rename

#
public static bool Rename(string oldName, string newName)
Rename a stored skin. Fails when the new name is taken or invalid. The canvas follows the skin it was using.
oldName (string)
newName (string)

Save

#
public static void Save(string name, SkinDefinition definition)
name (string)
definition (SkinDefinition)

StandardNames

#
public static string[] StandardNames()
The names of the skins shipped as resources, other than the default, sorted.

StandardText

#
public static string StandardText(string name)
The text of a shipped skin, or null if there is no such resource.
name (string)

UniqueName

#
public static string UniqueName(string stem)
A name not yet taken: the stem itself, or the stem followed by the first free number.
stem (string)

Events

CurrentChanged

#
public static event EventHandler CurrentChanged
Raised when the current skin changes, whether by choosing another skin or by saving or importing over the one in use. Capsule layouts depend on the skin's shape, so listeners have to invalidate their layouts, not only repaint.