Created
May 26, 2022 09:00
-
-
Save lin-ycv/ef274bae777b32fb05d1a0ae7dd82109 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Drawing; | |
// Descriptions | |
Component.Name = "Canvas Colour"; | |
Component.Description = "Changes colour of canvas background and grid"; | |
Component.Params.Input[0].Name = "Enable"; | |
Component.Params.Input[0].NickName = "E"; | |
Component.Params.Input[0].Description = "Toggle to enable/disable custom colour settings"; | |
Component.Params.Input[1].Name = "Background Colour"; | |
Component.Params.Input[1].NickName = "B"; | |
Component.Params.Input[1].Description = "Colour of canvas background"; | |
Component.Params.Input[2].Name = "Grid Colour"; | |
Component.Params.Input[2].NickName = "G"; | |
Component.Params.Input[2].Description = "Colour of Canvas Grid"; | |
// Defaults to white BG with no grid | |
if(G.IsEmpty) G = Color.FromArgb(0, 0, 0, 0); | |
if(B.IsEmpty) B = Color.FromArgb(255, 255, 255, 255); | |
if (E) | |
{ | |
Grasshopper.GUI.Canvas.GH_Skin.canvas_grid = G; | |
Grasshopper.GUI.Canvas.GH_Skin.canvas_back = B; | |
Grasshopper.GUI.Canvas.GH_Skin.canvas_edge = Color.FromArgb(255, 0, 0, 0); | |
Grasshopper.GUI.Canvas.GH_Skin.canvas_shade = Color.FromArgb(80, 0, 0, 0); | |
} | |
else | |
{ | |
// GH DEFAULTS | |
Grasshopper.GUI.Canvas.GH_Skin.canvas_grid = Color.FromArgb(30, 0, 0, 0); | |
Grasshopper.GUI.Canvas.GH_Skin.canvas_back = Color.FromArgb(255, 212, 208, 200); | |
Grasshopper.GUI.Canvas.GH_Skin.canvas_edge = Color.FromArgb(255, 0, 0, 0); | |
Grasshopper.GUI.Canvas.GH_Skin.canvas_shade = Color.FromArgb(80, 0, 0, 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment