Table of Contents

Struct Color

Namespace
Root.ReportNet.Pdf
Assembly
ReportNet.dll

Represents an RGB color.

public readonly struct Color
Inherited Members

Examples

Color rgb = Color.FromRgb(64, 128, 192);
Color gray = Color.FromGray(224);

Properties

B

Gets the value of the blue component [0..255] of the color.

public byte B { get; }

Property Value

byte

The value of the blue component.

Black

Gets the color black.

public static Color Black { get; }

Property Value

Color

The color black.

Blue

Gets the color blue.

public static Color Blue { get; }

Property Value

Color

The color blue.

Brown

Gets the color brown.

public static Color Brown { get; }

Property Value

Color

The color brown.

Cyan

Gets the color cyan.

public static Color Cyan { get; }

Property Value

Color

The color cyan.

DarkGreen

Gets the color dark green.

public static Color DarkGreen { get; }

Property Value

Color

The color dark green.

DarkOrange

Gets the color dark orange.

public static Color DarkOrange { get; }

Property Value

Color

The color dark orange.

G

Gets the value of the green component [0..255] of the color.

public byte G { get; }

Property Value

byte

The value of the green component.

Gray

Gets the color gray.

public static Color Gray { get; }

Property Value

Color

The color gray.

Green

Gets the color green.

public static Color Green { get; }

Property Value

Color

The color green.

LightBlue

Gets the color light blue.

public static Color LightBlue { get; }

Property Value

Color

The color light blue.

LightGray

Gets the color light gray.

public static Color LightGray { get; }

Property Value

Color

The color light gray.

Lime

Gets the color lime.

public static Color Lime { get; }

Property Value

Color

The color lime.

Magenta

Gets the color magenta.

public static Color Magenta { get; }

Property Value

Color

The color magenta.

Maroon

Gets the color maroon.

public static Color Maroon { get; }

Property Value

Color

The color maroon.

Navy

Gets the color navy.

public static Color Navy { get; }

Property Value

Color

The color navy.

Olive

Gets the color olive.

public static Color Olive { get; }

Property Value

Color

The color olive.

Orange

Gets the color orange.

public static Color Orange { get; }

Property Value

Color

The color orange.

Purple

Gets the color purple.

public static Color Purple { get; }

Property Value

Color

The color purple.

R

Gets the value of the red component [0..255] of the color.

public byte R { get; }

Property Value

byte

The value of the red component.

Red

Gets the color red.

public static Color Red { get; }

Property Value

Color

The color red.

Silver

Gets the color silver.

public static Color Silver { get; }

Property Value

Color

The color silver.

SteelBlue

Gets the color steel blue.

public static Color SteelBlue { get; }

Property Value

Color

The color steel blue.

Teal

Gets the color teal.

public static Color Teal { get; }

Property Value

Color

The color teal.

White

Gets the color white.

public static Color White { get; }

Property Value

Color

The color white.

Yellow

Gets the color yellow.

public static Color Yellow { get; }

Property Value

Color

The color yellow.

Methods

Darker(double)

Darkens the color by the specified factor [0..1].

public Color Darker(double factor)

Parameters

factor double

The darkening factor [0..1]. 0 creates black, 1 leaves the colour the same.

Returns

Color

The darkened 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.

FromGray(int)

Creates a grayscale color from the specified gray value.

public static Color FromGray(int gray)

Parameters

gray int

The gray component value [0..255].

Returns

Color

The grayscale color created from the gray value.

Exceptions

ArgumentOutOfRangeException

The gray value is out of range [0..255].

FromRgb(int, int, int)

Creates a color from the specified RGB values.

public static Color FromRgb(int red, int green, int blue)

Parameters

red int

The value of the red component [0..255].

green int

The value of the green component [0..255].

blue int

The value of the blue component [0..255].

Returns

Color

The color created from the RGB values.

Exceptions

ArgumentOutOfRangeException

The red, green or blue component is out of range [0..255].

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.

Operators

operator ==(Color, Color)

Determines whether two colors are equal.

public static bool operator ==(Color left, Color right)

Parameters

left Color

The first color to compare.

right Color

The second color to compare.

Returns

bool

true if the two colors are equal; otherwise false.

operator !=(Color, Color)

Determines whether two colors are not equal.

public static bool operator !=(Color left, Color right)

Parameters

left Color

The first color to compare.

right Color

The second color to compare.

Returns

bool

true if the two colors are not equal; otherwise false.

See Also