Grasshopper API
GH_GraphicsUtilForegroundColour Method |
Calculates a suitable foreground color. If the background
is lighter than 50%, the foreground will be darker, otherwise the foreground will be lighter.
Namespace: Grasshopper.GUI
Assembly: Grasshopper (in Grasshopper.dll)

public static Color ForegroundColour( Color col, int contrast = 30 )
Public Shared Function ForegroundColour ( col As Color, Optional contrast As Integer = 30 ) As Color
Parameters
- col
- Type: System.DrawingColor
Foreground colour that works well on the given background colour. - contrast (Optional)
- Type: SystemInt32
Contrast amount (in 0~255 range)
Return Value
Type: Color