Struct Color
- Namespace
- MigraDoc.DocumentObjectModel
- Assembly
- MigraDoc.DocumentObjectModel.dll
The Color class represents an ARGB color value.
public struct Color
Constructors
- Color(byte, byte, byte)
Initializes a new instance of the Color class.
- Color(byte, byte, byte, byte)
Initializes a new instance of the Color class.
- Color(double, double, double, double)
Initializes a new instance of the Color class with a CMYK color. All values must be in the range 0 to 100 percent.
- Color(double, double, double, double, double)
Initializes a new instance of the Color class with a CMYK color. All values must be in the range 0 to 100 percent.
- Color(uint)
Initializes a new instance of the Color class.
Fields
- Empty
Represents the null color. Each property of the null color is zero.
Properties
- A
Gets the alpha (transparency) part of the RGB Color. The value is in the range 0 to 255.
- Alpha
Gets the alpha (transparency) part of the CMYK Color. The value is in the range 0 (transparent) to 100 (opaque) percent.
- Argb
Gets or sets the ARGB value.
- B
Gets the blue part of the Color. The value is in the range 0 to 255.
- C
Gets the cyan part of the Color. The value is in the range 0 to 100 percent.
- G
Gets the green part of the Color. The value is in the range 0 to 255.
- IsCmyk
Gets a value indicating whether this instance is a CMYK color.
- IsEmpty
Determines whether this color is empty.
- K
Gets the key (black) part of the Color. The value is in the range 0 to 100 percent.
- M
Gets the magenta part of the Color. The value is in the range 0 to 100 percent.
- R
Gets the red part of the Color. The value is in the range 0 to 255.
- RGB
Gets or sets the RGB value.
- Y
Gets the yellow part of the Color. The value is in the range 0 to 100 percent.
Methods
- Equals(object?)
Calls base class Equals.
- FromArgb(byte, byte, byte, byte)
Creates an RGB color from alpha, red, green, and blue.
- FromCmyk(double, double, double, double)
Creates a Color structure from the specified CMYK values. All values must be in the range 0 to 100 percent.
- FromCmyk(double, double, double, double, double)
Creates a Color structure from the specified CMYK values. All values must be in the range 0 to 100 percent.
- FromCmykColor(double, Color)
Creates a CMYK color from an existing color with a new alpha (transparency) value.
- FromRgb(byte, byte, byte)
Creates an RGB color from red, green, and blue.
- FromRgbColor(byte, Color)
Creates an RGB color from an existing color with a new alpha (transparency) value.
- GetHashCode()
Gets the ARGB value that this Color instance represents.
- GetMixedTransparencyColor()
Gets a non-transparent color brightened in terms of transparency if any is given (A < 255), otherwise this instance itself.
- Parse(string)
Parses the string and returns a color object. Throws ArgumentException if color is invalid. Supports four different formats for hex colors. Format 1: uses prefix "0x", followed by as many hex digits as needed. Important: do not forget the opacity, so use 7 or 8 digits. Format 2: uses prefix "#", followed by exactly 8 digits including opacity. Format 3: uses prefix "#", followed by exactly 6 digits; opacity will be 0xff. Format 4: uses prefix "#", followed by exactly 3 digits; opacity will be 0xff; "#ccc" will be treated as "#ffcccccc", "#d24" will be treated as "#ffdd2244".
- ToString()
Writes the Color object in its hexadecimal value.
Operators
- operator ==(Color, Color)
Compares two color objects. True if both ARGB values are equal, false otherwise.
- operator !=(Color, Color)
Compares two color objects. True if both ARGB values are not equal, false otherwise.