Table of Contents

Class ColorExtensions

Namespace
Gamelogic.Extensions
Assembly
Gamelogic.Extensions.dll

Provides some utility functions for Colors.

[Version(1, 0, 0)]
public static class ColorExtensions
Inheritance
ColorExtensions
Inherited Members

Fields

HexStringBlack

Methods

Brightness(Color)

Returns the brightness of the color, defined as the average off the three color channels.

Darker(Color)

Returns a color darker than the given color.

Invert(Color)

Returns a new color that is this color inverted.

IsApproximatelyBlack(Color)

Returns whether the color is black or almost black.

IsApproximatelyWhite(Color)

Returns whether the color is white or almost white.

Lighter(Color)

Returns a color lighter than the given color.

Opaque(Color)

Returns an opaque version of the given color.

ParseHex(string)

Parses a Color from a hexadecimal string.

ToRGBAHex(Color)

Converts a color to an eight-character string of the RGBA values of the color in hexadecimal.

ToRGBHex(Color)

Converts a color to a six-character string of the RGB values of the color in hexadecimal.

TryParseHex(string, out Color)

Tries to parse a Color from a hexadecimal string.

WithAlpha(Color, float)

Returns the same color, but with the specified alpha.

WithBrightness(Color, float)

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