Show / Hide Table of Contents

    Class Color

    Inheritance
    System.Object
    Color
    Inherited Members
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Mapsui.Styles
    Assembly: Mapsui.dll
    Syntax
    public class Color

    Constructors

    | Improve this Doc View Source

    Color()

    Declaration
    public Color()
    | Improve this Doc View Source

    Color(Color)

    Declaration
    public Color(Color color)
    Parameters
    Type Name Description
    Color color
    | Improve this Doc View Source

    Color(Int32, Int32, Int32, Int32)

    Declaration
    public Color(int red, int green, int blue, int alpha = 255)
    Parameters
    Type Name Description
    System.Int32 red
    System.Int32 green
    System.Int32 blue
    System.Int32 alpha

    Fields

    | Improve this Doc View Source

    KnownColors

    Known HTML color names and hex code for RGB color

    Declaration
    public static readonly Dictionary<string, string> KnownColors
    Field Value
    Type Description
    System.Collections.Generic.Dictionary<System.String, System.String>

    Properties

    | Improve this Doc View Source

    A

    Declaration
    public int A { get; set; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    B

    Declaration
    public int B { get; set; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    Black

    Declaration
    public static Color Black { get; }
    Property Value
    Type Description
    Color
    | Improve this Doc View Source

    Blue

    Declaration
    public static Color Blue { get; }
    Property Value
    Type Description
    Color
    | Improve this Doc View Source

    Cyan

    Declaration
    public static Color Cyan { get; }
    Property Value
    Type Description
    Color
    | Improve this Doc View Source

    G

    Declaration
    public int G { get; set; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    Gray

    Declaration
    public static Color Gray { get; }
    Property Value
    Type Description
    Color
    | Improve this Doc View Source

    Green

    Declaration
    public static Color Green { get; }
    Property Value
    Type Description
    Color
    | Improve this Doc View Source

    Indigo

    Declaration
    public static Color Indigo { get; }
    Property Value
    Type Description
    Color
    | Improve this Doc View Source

    Orange

    Declaration
    public static Color Orange { get; }
    Property Value
    Type Description
    Color
    | Improve this Doc View Source

    R

    Declaration
    public int R { get; set; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    Red

    Declaration
    public static Color Red { get; }
    Property Value
    Type Description
    Color
    | Improve this Doc View Source

    Transparent

    Declaration
    public static Color Transparent { get; }
    Property Value
    Type Description
    Color
    | Improve this Doc View Source

    Violet

    Declaration
    public static Color Violet { get; }
    Property Value
    Type Description
    Color
    | Improve this Doc View Source

    White

    Declaration
    public static Color White { get; }
    Property Value
    Type Description
    Color
    | Improve this Doc View Source

    Yellow

    Declaration
    public static Color Yellow { get; }
    Property Value
    Type Description
    Color

    Methods

    | Improve this Doc View Source

    Equals(Color)

    Declaration
    public bool Equals(Color color)
    Parameters
    Type Name Description
    Color color
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Equals(Object)

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj
    Returns
    Type Description
    System.Boolean
    Overrides
    System.Object.Equals(System.Object)
    | Improve this Doc View Source

    FromArgb(Int32, Int32, Int32, Int32)

    Declaration
    public static Color FromArgb(int a, int r, int g, int b)
    Parameters
    Type Name Description
    System.Int32 a
    System.Int32 r
    System.Int32 g
    System.Int32 b
    Returns
    Type Description
    Color
    | Improve this Doc View Source

    FromHsl(Single, Single, Single, Int32)

    Found at http://james-ramsden.com/convert-from-hsl-to-rgb-colour-codes-in-c/

    Declaration
    public static Color FromHsl(float h, float s, float l, int a = 255)
    Parameters
    Type Name Description
    System.Single h
    System.Single s
    System.Single l
    System.Int32 a
    Returns
    Type Description
    Color
    | Improve this Doc View Source

    FromString(String)

    Converts a string in Mapbox GL format to a Mapsui Color

    This function assumes, that alpha is a float in range from 0.0 to 1.0. It converts this float in Maspui Color alpha without rounding. The following colors could be converted:

    • Named colors with known Html names
    • Colors as Html color values with leading '#' and 6 or 3 numbers
    • Function rgb(r,g,b) with values for red, green and blue
    • Function rgba(r,g,b,a) with values for red, green, blue and alpha. Here alpha is between 0.0 and 1.0 like opacity.
    • Function hsl(h,s,l) with values hue (0.0 to 360.0), saturation (0.0% - 100.0%) and lightness (0.0% - 100.0%)
    • Function hsla(h,s,l,a) with values hue (0.0 to 360.0), saturation (0.0% - 100.0%), lightness (0.0% - 100.0%) and alpha. Here alpha is between 0.0 and 1.0 like opacity.
    Declaration
    public static Color FromString(string from)
    Parameters
    Type Name Description
    System.String from

    String with HTML color representation or function like rgb() or hsl()

    Returns
    Type Description
    Color

    Converted Mapsui Color

    | Improve this Doc View Source

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32
    Overrides
    System.Object.GetHashCode()
    | Improve this Doc View Source

    Opacity(Color, Nullable<Single>)

    Change alpha channel from given color to respect opacity

    Declaration
    public static Color Opacity(Color color, float? opacity)
    Parameters
    Type Name Description
    Color color

    Mapsui Color to change

    System.Nullable<System.Single> opacity

    Opacity of the new color

    Returns
    Type Description
    Color

    New color respecting old alpha and new opacity

    Operators

    | Improve this Doc View Source

    Equality(Color, Color)

    Declaration
    public static bool operator ==(Color color1, Color color2)
    Parameters
    Type Name Description
    Color color1
    Color color2
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Inequality(Color, Color)

    Declaration
    public static bool operator !=(Color color1, Color color2)
    Parameters
    Type Name Description
    Color color1
    Color color2
    Returns
    Type Description
    System.Boolean

    Extension Methods

    ColorExtensions.ToSkia(Color, Single)
    ColorExtensions.ToForms(Color)
    • Improve this Doc
    • View Source
    Back to top Generated by DocFX