Table of Contents

Struct Color

Namespace
ScottPlot
Assembly
ScottPlot.dll
public readonly struct Color
Inherited Members
Extension Methods

Constructors

Color(SKColor)

public Color(SKColor color)

Parameters

color SKColor

Color(byte, byte, byte, byte)

public Color(byte red, byte green, byte blue, byte alpha = 255)

Parameters

red byte
green byte
blue byte
alpha byte

Color(Color)

public Color(Color color)

Parameters

color Color

Color(float, float, float, float)

public Color(float red, float green, float blue, float alpha = 1)

Parameters

red float
green float
blue float
alpha float

Color(string)

public Color(string hexCode)

Parameters

hexCode string

Color(uint)

public Color(uint argb)

Parameters

argb uint

Fields

Alpha

public readonly byte Alpha

Field Value

byte

Blue

public readonly byte Blue

Field Value

byte

Green

public readonly byte Green

Field Value

byte

Red

public readonly byte Red

Field Value

byte

Properties

A

public byte A { get; }

Property Value

byte

ARGB

public uint ARGB { get; }

Property Value

uint

B

public byte B { get; }

Property Value

byte

G

public byte G { get; }

Property Value

byte

Hue

Hue as a fraction from 0 to 1

public float Hue { get; }

Property Value

float

Luminance

Luminance as a fraction from 0 to 1

public float Luminance { get; }

Property Value

float

PremultipliedARGB

public uint PremultipliedARGB { get; }

Property Value

uint

R

public byte R { get; }

Property Value

byte

Saturation

Saturation as a fraction from 0 to 1

public float Saturation { get; }

Property Value

float

Methods

Darken(double)

Amount to darken the color (from 0-1). Larger numbers produce darker results.

public Color Darken(double fraction = 0.5)

Parameters

fraction double

Returns

Color

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

FromARGB(int)

public static Color FromARGB(int argb)

Parameters

argb int

Returns

Color

FromARGB(uint)

public static Color FromARGB(uint argb)

Parameters

argb uint

Returns

Color

FromColor(Color)

Create a ScottPlot color from a System Drawing Color

public static Color FromColor(Color color)

Parameters

color Color

Returns

Color

FromHSL(float, float, float, float)

Create a Color given Hue, Saturation, and Luminance (as fractions from 0 to 1)

public static Color FromHSL(float hue, float saturation, float luminosity, float alpha = 1)

Parameters

hue float
saturation float
luminosity float
alpha float

Returns

Color

FromHex(IEnumerable<string>)

Create a collection of colors from a collection of hex strings formatted like "#66AA99"

public static Color[] FromHex(IEnumerable<string> hex)

Parameters

hex IEnumerable<string>

Returns

Color[]

FromHex(string)

public static Color FromHex(string hex)

Parameters

hex string

Returns

Color

FromHtml(string)

public static Color FromHtml(string html)

Parameters

html string

Returns

Color

FromSDColor(Color)

Create a ScottPlot color from a System Drawing Color

public static Color FromSDColor(Color sdColor)

Parameters

sdColor Color

Returns

Color

FromSKColor(SKColor)

Create a ScottPlot color from a SkiaSharp Color

public static Color FromSKColor(SKColor skcolor)

Parameters

skcolor SKColor

Returns

Color

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

Gray(byte)

public static Color Gray(byte value)

Parameters

value byte

Returns

Color

InterpolateArrayRgb(Color, int)

public Color[] InterpolateArrayRgb(Color c1, int steps)

Parameters

c1 Color
steps int

Returns

Color[]

InterpolateRgb(Color, Color, double)

public static Color InterpolateRgb(Color c1, Color c2, double fraction)

Parameters

c1 Color
c2 Color
fraction double

Returns

Color

InterpolateRgb(Color, double)

public Color InterpolateRgb(Color c1, double fraction)

Parameters

c1 Color
fraction double

Returns

Color

InterpolateRgbArray(Color, Color, int)

public static Color[] InterpolateRgbArray(Color c1, Color c2, int steps)

Parameters

c1 Color
c2 Color
steps int

Returns

Color[]

Lighten(double)

Amount to lighten the color (from 0-1). Larger numbers produce lighter results.

public Color Lighten(double fraction = 0.5)

Parameters

fraction double

Returns

Color

MixedWith(Color, double)

Return this color mixed with another color.

public Color MixedWith(Color otherColor, double fraction)

Parameters

otherColor Color

Color to mix with this color

fraction double

Fraction of otherColor to use

Returns

Color

RandomHue()

public static Color RandomHue()

Returns

Color

ToColor(Color)

public static Color ToColor(Color color)

Parameters

color Color

Returns

Color

ToHSL()

Hue, Saturation, and Luminance (as fractions from 0 to 1)

public (float h, float s, float l) ToHSL()

Returns

(float h, float s, float l)

ToHex()

return a string like "#6699AA" or "#6699AA42" if a semitransparent alpha is in use

public string ToHex()

Returns

string

ToSDColor()

public Color ToSDColor()

Returns

Color

ToSKColor()

Create a SkiaSharp color

public SKColor ToSKColor()

Returns

SKColor

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

ToStringRGB()

return a string like "#6699AA"

public string ToStringRGB()

Returns

string

ToStringRGBA()

return a string like "#6699AAFF"

public string ToStringRGBA()

Returns

string

WithAlpha(byte)

public Color WithAlpha(byte alpha)

Parameters

alpha byte

Returns

Color

WithAlpha(double)

public Color WithAlpha(double alpha)

Parameters

alpha double

Returns

Color

WithBlue(byte)

public Color WithBlue(byte blue)

Parameters

blue byte

Returns

Color

WithGreen(byte)

public Color WithGreen(byte green)

Parameters

green byte

Returns

Color

WithLightness(float)

public Color WithLightness(float lightness = 0.5)

Parameters

lightness float

Returns

Color

WithOpacity(double)

public Color WithOpacity(double opacity = 0.5)

Parameters

opacity double

Returns

Color

WithRed(byte)

public Color WithRed(byte red)

Parameters

red byte

Returns

Color

Operators

operator ==(Color, Color)

public static bool operator ==(Color a, Color b)

Parameters

a Color
b Color

Returns

bool

operator !=(Color, Color)

public static bool operator !=(Color a, Color b)

Parameters

a Color
b Color

Returns

bool