Table of Contents

Method GetDimColor

Namespace
Terminal.Gui.Drawing
Assembly
Terminal.Gui.dll

GetDimColor(double)

Returns a color with the same hue and saturation as this color, but with a significantly lower lightness, making it suitable for use as a shadow or background contrast color in UI elements.

public Color GetDimColor(double dimAmount = 0.2)

Parameters

dimAmount double

The percent amount to dim the color by. The default is 20%.

Returns

Color

A Color instance with the same hue and saturation as this color, but with a much lower lightness.

Remarks

This method darkens the color by reducing its lightness in HSL color space:

  • If the color is already very dark, returns DarkGray.
  • Otherwise, reduces the lightness by a fixed amount (default 30%).
  • If the adjustment resulted in a color too close to the original, a larger adjustment is made.
This ensures the returned color is always visually distinct and suitable for shadowing or de-emphasis.