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

Boolean

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.

AlphaComponent

This property returns the alpha component of the GeoColor.

public byte AlphaComponent { get; set; }

Property Value

Byte

Remarks:

None

RedComponent

This property returns the red component of the GeoColor.

public byte RedComponent { get; set; }

Property Value

Byte

Remarks:

None

GreenComponent

This property returns the green component of the GeoColor.

public byte GreenComponent { get; set; }

Property Value

Byte

Remarks:

None

BlueComponent

This property returns the blue component of the GeoColor.

public byte BlueComponent { get; set; }

Property Value

Byte

Remarks:

None

Hue

This property returns the hue component of the GeoColor.

public float Hue { get; }

Property Value

Single

Remarks:

None

Saturation

This property returns the saturation component of the GeoColor.

public float Saturation { get; }

Property Value

Single

Remarks:

None

Luminance

This property returns the luminance component of the GeoColor.

public float Luminance { get; }

Property Value

Single

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, Int32)

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 Int32

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

Returns

Collection<GeoColor>

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

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, Int32)

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 Int32

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

Returns

Collection<GeoColor>

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

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, Int32, 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 Int32
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

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

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(Int32, Single, Single, Single)

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 Int32

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

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

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

luminance Single
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(Int32)

This method returns a GeoColor from an OLE color.

public static GeoColor FromOle(int oleColor)

Parameters

oleColor Int32
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

Parse(String)

internal static GeoColor Parse(string colorExpression)

Parameters

colorExpression String

Returns

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
The alpha component. Valid values are 0 through 255.

colorType RandomColorType
A ColorType defines types of color.

Returns

GeoColor
A GeoColor structure the method created.

FromWin32(Int32)

This method returns a GeoColor from a Win32 color.

public static GeoColor FromWin32(int win32Color)

Parameters

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

Returns

GeoColor
This method returns a GeoColor from a Win32 color.

Remarks:

None

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

Int32
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

Int32
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

Boolean
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

Int32
This method returns the hash code.

Remarks:

None

<Parse>g__GetNubmers|62_0(GroupCollection)

internal static Double[] <Parse>g__GetNubmers|62_0(GroupCollection groups)

Parameters

groups GroupCollection

Returns

Double[]