Skip to main content

ColorHelper Class

Definition​

Assembly:Avalonia.Controls.ColorPicker
Package:Avalonia.Controls.ColorPicker

Contains helpers useful when working with colors.

public class ColorHelper

Inheritance: object -> ColorHelper

Methods​

NameDescription
GetRelativeLuminanceGets the relative (perceptual) luminance/brightness of the given color. 1 is closer to white while 0 is closer to black.
ToDisplayNameDetermines an approximate display name for the given color.

GetRelativeLuminance Method​

Gets the relative (perceptual) luminance/brightness of the given color. 1 is closer to white while 0 is closer to black.

public double GetRelativeLuminance(Avalonia.Media.Color color)

Parameters​

color Avalonia.Media.Color

The color to calculate relative luminance for.

Returns​

double

The relative (perceptual) luminance/brightness of the given color.

ToDisplayName Method​

Determines an approximate display name for the given color.

public string ToDisplayName(Avalonia.Media.Color color)

Parameters​

color Avalonia.Media.Color

The color to get the display name for.

Returns​

string

The approximate color display name.

Properties​

NameDescription
ToDisplayNameExistsDetermines if color display names are supported based on the current thread culture.

ToDisplayNameExists Property​

Determines if color display names are supported based on the current thread culture.

public bool ToDisplayNameExists { get; set; }

Remarks​

Only English names are currently supported following known color names. In the future known color names could be localized.