 |
Color Structure |
Represents a 32-bit ARGB color (alpha + red + green + blue, each 0–255). Used throughout
the SelectPdf public API.
Inheritance HierarchySystemObject
SystemValueType
SelectPdf.Universal.DrawingColor
Namespace: SelectPdf.Universal.DrawingAssembly: SelectPdf.HtmlToPdf.Universal (in SelectPdf.HtmlToPdf.Universal.dll) Version: 26.4
Syntaxpublic struct Color : IEquatable<Color>
Public Structure Color
Implements IEquatable(Of Color)
The Color type exposes the following members.
Properties| | Name | Description |
|---|
 | A | The alpha component (0 = fully transparent, 255 = fully opaque). |
 | B | The blue component (0–255). |
  | Black | Pure black (#000000). |
  | Blue | Pure blue (#0000FF). |
  | Cyan | Pure cyan (#00FFFF). |
  | DarkGray | DarkGray (#A9A9A9). |
 | G | The green component (0–255). |
  | Gray | Standard gray (#808080). |
  | Green | Pure green (#008000). |
 | IsEmpty | True if this is the default (uninitialized) value of Color. |
  | LightGray | LightGray (#D3D3D3). |
  | Magenta | Pure magenta (#FF00FF). |
  | Orange | Orange (#FFA500). |
 | R | The red component (0–255). |
  | Red | Pure red (#FF0000). |
  | Transparent | A fully transparent color (A=0). |
  | White | Pure white (#FFFFFF). |
  | Yellow | Pure yellow (#FFFF00). |
Top
Methods| | Name | Description |
|---|
 | Equals(Color) | Indicates whether this color and the specified Color have the same ARGB value. |
 | Equals(Object) | Indicates whether this color and the specified object have the same value. (Overrides ValueTypeEquals(Object)) |
  | FromArgb(Int32) |
Constructs a color from a raw 32-bit ARGB value (layout: AARRGGBB).
|
  | FromArgb(Int32, Color) |
Constructs a color by replacing the alpha component of an existing color.
|
  | FromArgb(Int32, Int32, Int32) |
Constructs a fully-opaque color from the given red/green/blue components.
|
  | FromArgb(Int32, Int32, Int32, Int32) |
Constructs a color with the given alpha/red/green/blue components. Each value is
clamped to 0–255.
|
 | GetHashCode | Returns the hash code for this color. (Overrides ValueTypeGetHashCode) |
 | ToArgb | Gets the raw 32-bit ARGB value (layout: AARRGGBB). |
 | ToString | Returns a string representation of this Color (its A, R, G and B components). (Overrides ValueTypeToString) |
Top
Operators
Fields| | Name | Description |
|---|
  | Empty |
Represents the uninitialized color (all components zero, including alpha). Distinct
from fully-transparent black, which is the same bit pattern but created explicitly.
Callers check IsEmpty before use if the color might not have been set.
|
Top
Remarks
The struct is deliberately minimal — enough to construct common colors, compare values,
and round-trip via
PdfColor. For richer helpers (HSL conversions,
named-color lookups, etc.), build those on top of
FromArgb(Int32, Int32, Int32, Int32) / the R/G/B/A accessors.
ExampleSelectPdf.Universal.Drawing.Color navy =
SelectPdf.Universal.Drawing.Color.FromArgb(0, 0, 128);
SelectPdf.Universal.Drawing.Color faded =
SelectPdf.Universal.Drawing.Color.FromArgb(128, navy);
int argb = navy.ToArgb();
byte red = navy.R;Dim navy As SelectPdf.Universal.Drawing.Color =
SelectPdf.Universal.Drawing.Color.FromArgb(0, 0, 128)
Dim faded As SelectPdf.Universal.Drawing.Color =
SelectPdf.Universal.Drawing.Color.FromArgb(128, navy)
Dim argb As Integer = navy.ToArgb()
Dim red As Byte = navy.R
See Also