Skip to content

GeoColor

Namespace: ThinkGeo.Core

This structure represents a color for drawing on a GeoCanvas.

public class GeoColor

Inheritance objectGeoColor

Properties

IsTransparent

Verify if the GeoColor is transparent, it is considered to be transparent if the Alpha Value is 0.

public bool IsTransparent { get; }

Property Value

bool

HtmlColor

Gets or sets the color of the HTML.

public string HtmlColor { get; set; }

Property Value

string

        The color of the HTML.

Ahsl

Gets or sets the ahsl.

public string Ahsl { get; set; }

Property Value

string

        The ahsl.

Argb

Gets or sets the ARGB.

public string Argb { get; set; }

Property Value

string

        The ARGB.

A

This property returns the alpha component of the GeoColor.

public byte A { get; set; }

Property Value

byte

Remarks:

None

R

This property returns the red component of the GeoColor.

public byte R { get; set; }

Property Value

byte

Remarks:

None

G

This property returns the green component of the GeoColor.

public byte G { get; set; }

Property Value

byte

Remarks:

None

B

This property returns the blue component of the GeoColor.

public byte B { get; set; }

Property Value

byte

Remarks:

None

Hue

This property returns the hue component of the GeoColor.

public float Hue { get; }

Property Value

float

Remarks:

None

Saturation

This property returns the saturation component of the GeoColor.

public float Saturation { get; }

Property Value

float

Remarks:

None

Luminance

This property returns the luminance component of the GeoColor.

public float Luminance { get; }

Property Value

float

Remarks:

None

Constructors

GeoColor()

Initializes a new instance of the GeoColor class.

public GeoColor()

GeoColor(byte, byte, byte)

This constructor creates a new color.

public GeoColor(byte red, byte green, byte blue)

Parameters

red byte
This parameter specifies the red component of the color.

green byte
This parameter specifies the green component of the color.

blue byte
This parameter specifies the blue component of the color.

Exceptions

ArgumentOutOfRangeException
If you pass in a red value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

ArgumentOutOfRangeException
If you pass in a green value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

ArgumentOutOfRangeException
If you pass in a blue value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

Remarks:

None

GeoColor(byte, byte, byte, byte)

This constructor creates a new color.

public GeoColor(byte alpha, byte red, byte green, byte blue)

Parameters

alpha byte
This parameter specifies the alpha, or transparent, component of the color.

red byte
This parameter specifies the red component of the color.

green byte
This parameter specifies the green component of the color.

blue byte
This parameter specifies the blue component of the color.

Exceptions

ArgumentOutOfRangeException
If you pass in a red value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

ArgumentOutOfRangeException
If you pass in a blue value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

ArgumentOutOfRangeException
If you pass in a green value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

ArgumentOutOfRangeException
If you pass in a alpha value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

Remarks:

None

GeoColor(byte, GeoColor)

This constructor creates a new color.

public GeoColor(byte alpha, GeoColor color)

Parameters

alpha byte
This parameter specifies the alpha component. An alpha of 0 is totally transparent.

color GeoColor
This parameter specifies the base color.

Remarks:

You can use this overload to create a transparent version of another color.

Methods

GetColorsInHueFamily(GeoColor, int)

This method returns a collection of GeoColors based on the same hue that is passed in.

public static Collection<GeoColor> GetColorsInHueFamily(GeoColor baseColor, int numbersOfColors)

Parameters

baseColor GeoColor
This parameter is the color on which you want to base the color collection.

numbersOfColors int
This parameter represents the number of colors you want returned from the method.

Returns

Collection<GeoColor>

Exceptions

ArgumentOutOfRangeException
If you pass in a numberOfColors value that is not between 1 and 255, it will throw a ArgumentOutOfRangeException.

Remarks:

This method is useful when you want to get a number of colors that have the same hue. For example, you can use this in maps that represent class breaks. If you passed in a red hue, then the method would return variations such as light red, dark red, pastel red, etc.

GetColorsInQualityFamily(GeoColor, int)

This method returns a collection of GeoColors based on the same quality (luminosity and saturation) that is passed in.

public static Collection<GeoColor> GetColorsInQualityFamily(GeoColor baseColor, int numberOfColors)

Parameters

baseColor GeoColor
This parameter is the color on which you want to base the color collection.

numberOfColors int
This parameter represents the number of colors you want returned from the method.

Returns

Collection<GeoColor>

Exceptions

ArgumentOutOfRangeException
If you pass in a numberOfColors value that is not between 1 and 255, it will throw a ArgumentOutOfRangeException.

Remarks:

This method is useful when you want to get a number of different colors that have the same quality. For example, you can use this in maps that represent countries or connected places. If you passed in bright red, then the method would return variants such as bright blue, bright green, etc. If you passed in dark red, you would get dark blue, dark green, etc.

GetColorsInQualityFamily(GeoColor, GeoColor, int, ColorWheelDirection)

Gets the colors in quality family.

public static Collection<GeoColor> GetColorsInQualityFamily(GeoColor fromColor, GeoColor toColor, int numberOfColors, ColorWheelDirection colorWheelDirection)

Parameters

fromColor GeoColor
From color.

toColor GeoColor
To color.

numberOfColors int
The number of colors.

colorWheelDirection ColorWheelDirection
The color wheel direction.

Returns

Collection<GeoColor>

FromArgb(byte, byte, byte, byte)

This method returns a GeoColor based on the Alpha, Red, Green, and Blue components.

public static GeoColor FromArgb(byte alpha, byte red, byte green, byte blue)

Parameters

alpha byte
This parameter specifies the alpha, or transparent, component of the color.

red byte
This parameter specifies the red component of the color.

green byte
This parameter specifies the green component of the color.

blue byte
This parameter specifies the blue component of the color.

Returns

GeoColor

Exceptions

ArgumentOutOfRangeException
If you pass in a alpha value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

ArgumentOutOfRangeException
If you pass in a red value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

ArgumentOutOfRangeException
If you pass in a green value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

ArgumentOutOfRangeException
If you pass in a blue value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

Remarks:

None

FromArgb(byte, GeoColor)

This method returns a GeoColor based on the Alpha, Red, Green, and Blue components.

public static GeoColor FromArgb(byte alpha, GeoColor baseColor)

Parameters

alpha byte
This parameter determines how transparent the color is. An alpha of 0 means it is totally transparent.

baseColor GeoColor
This parameter is the color you want to apply the transparency to.

Returns

GeoColor

        You can use this overload to create a transparent version of another
        color.

FromAhsl(int, float, float, float)

This parameter specifies the red component of the color. This method returns a GeoColor based on the Alpha, Hue, Saturation, and Luminosity components.

public static GeoColor FromAhsl(int alpha, float hue, float saturation, float luminance)

Parameters

alpha int
This parameter specifies the alpha, or transparent, component of the color.

hue float
This parameter specifies the hue component of the color.

saturation float
This parameter specifies the saturation component of the color.

luminance float
This parameter specifies the luminance component of the color.

Returns

GeoColor

Exceptions

ArgumentOutOfRangeException
If you pass in a alpha value which is not between 0 and 255, it will throw a ArgumentOutOfRangeException.

ArgumentOutOfRangeException
If you pass in a hue value which is not between 0 and 360, it will throw a ArgumentOutOfRangeException.

ArgumentOutOfRangeException
If you pass in a saturation value which is not between 0 and 1, it will throw a ArgumentOutOfRangeException.

ArgumentOutOfRangeException
If you pass in a luminance value which is not between 0 and 1, it will throw a ArgumentOutOfRangeException.

Remarks:

None

FromOle(int)

This method returns a GeoColor from an OLE color.

public static GeoColor FromOle(int oleColor)

Parameters

oleColor int
This parameter represents the OLE color you want to convert.

Returns

GeoColor
This method returns a GeoColor from an OLE color.

Remarks:

None

FromHtml(string)

This method returns a GeoColor from an HTML color (either in hexadecimal or a named color).

public static GeoColor FromHtml(string htmlColor)

Parameters

htmlColor string
This parameter represents the HTML color that you want to convert.

Returns

GeoColor
This method returns a GeoColor from an HTML color (either in hexadecimal or a named color).

Exceptions

ArgumentOutOfRangeException
If you pass in a htmlColor value which is not valid, it will throw a ArgumentOutOfRangeException.

Remarks:

None

4xU=(string)

internal static GeoColor 4xU=(string colorExpression)

Parameters

colorExpression string

Returns

GeoColor

FromHslString(string)

Parses an HSL color of the form such as: hsl(203, 60%, 46%)

public static GeoColor FromHslString(string hsl)

Parameters

hsl string
the hsl string such as: hsl(203, 60%, 46%)

Returns

GeoColor
The converted GeoColor

GetRandomGeoColor(RandomColorType)

Creates a random GeoColor structure based on the specific ColorType

public static GeoColor GetRandomGeoColor(RandomColorType colorType)

Parameters

colorType RandomColorType
A ColorType defines types of color.

Returns

GeoColor
A GeoColor structure the method created.

GetRandomGeoColor(byte, RandomColorType)

Creates a random GeoColor structure

public static GeoColor GetRandomGeoColor(byte alpha, RandomColorType colorType)

Parameters

alpha byte
Alpha component used for the generated color (0-255).

colorType RandomColorType
A ColorType defines types of color.

Returns

GeoColor
A GeoColor structure the method created.

FromWin32(int)

This method returns a GeoColor from a Win32 color.

public static GeoColor FromWin32(int win32Color)

Parameters

win32Color int
This parameter represents the Win32 color you want to convert.

Returns

GeoColor
This method returns a GeoColor from a Win32 color.

Remarks:

None

FromColorString(string)

try to read different formats color string, such as the ones start with "hsl", "rgb", "#".

public static GeoColor FromColorString(string colorString)

Parameters

colorString string

Returns

GeoColor

ToOle(GeoColor)

This method returns an OLE color from a GeoColor.

public static int ToOle(GeoColor color)

Parameters

color GeoColor
This parameter represents the GeoColor you want to convert.

Returns

int
This method returns an OLE color from a GeoColor.

Exceptions

ArgumentNullException
If you pass a null as the drawingColor, we will throw an ArgumentNullException.

Remarks:

None

ToHtml(GeoColor)

This method returns an HTML color from a GeoColor.

public static string ToHtml(GeoColor color)

Parameters

color GeoColor
This parameter represents the GeoColor you want to convert.

Returns

string
This method returns an HTML color from a GeoColor.

Exceptions

ArgumentNullException
If you pass a null as the drawingColor, we will throw an ArgumentNullException.

Remarks:

None

ToWin32(GeoColor)

This method returns a Win32 color from a GeoColor.

public static int ToWin32(GeoColor color)

Parameters

color GeoColor
This parameter represents the GeoColor you want to convert.

Returns

int
This method returns a Win32 color from a GeoColor.

Exceptions

ArgumentNullException
If you pass a null as the drawingColor, we will throw an ArgumentNullException.

ToString()

Converts to string.

public string ToString()

Returns

string

        A  that represents this instance.

Equals(object)

This method is an override of the Equals functionality.

public bool Equals(object obj)

Parameters

obj object
This parameter is the object you want to check to see if it is equal to the current instance.

Returns

bool
This method returns the Equals functionality.

Exceptions

ArgumentNullException
If you pass a null as the obj, we will throw an ArgumentNullException.

Remarks:

None

GetHashCode()

This method is an override of the GetHashCode functionality.

public int GetHashCode()

Returns

int
This method returns the hash code.

Remarks:

None

7BU=(GroupCollection)

internal static Double[] 7BU=(GroupCollection groups)

Parameters

groups GroupCollection

Returns

Double[]