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

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

Extension

#
public const string Extension = ".ghskin"

Properties

Current

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

CurrentSkin

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

Dim

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

Lit

#
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.
public static Skin Lit { get; }

Methods

Delete

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

Exists

#
public static bool Exists(
name
)

Export

#
public static void Export(
definition,
path
)

Import

#
Copy a skin file into the folder under its own file name.
public static bool Import(
path,
File to import.
overwrite,
Whether an existing skin of that name may be replaced.
out string
name
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(
name
)

IsValidName

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

Load

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

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.
public static SkinDefinition LoadCurrent()

Names

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

NamesAndInfos

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

PathOf

#
public static string PathOf(
name
)

Rename

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

Save

#
public static void Save(
name,
definition
)

StandardNames

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

StandardText

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

UniqueName

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

Events

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.
public static event EventHandler CurrentChanged