Table of Contents

Method WithBrightness

Namespace
Gamelogic.Extensions
Assembly
Gamelogic.Extensions.dll

WithBrightness(Color, float)

Returns a new color with the RGB values scaled so that the color has the given brightness.

public static Color WithBrightness(this Color color, float brightness)

Parameters

color Color

The base color to scale.

brightness float

The target brightness value.

Returns

Color

A new color scaled to the given brightness.

Remarks

If the color is too dark, a gray is returned with the right brightness. The alpha is left unchanged.