Click or drag to resize
Pdf Library for .NET

Color Structure

Represents a 32-bit ARGB color (alpha + red + green + blue, each 0–255). Used throughout the SelectPdf public API.
Inheritance Hierarchy
SystemObject
  SystemValueType
    SelectPdf.Universal.DrawingColor

Namespace: SelectPdf.Universal.Drawing
Assembly: SelectPdf.Universal (in SelectPdf.Universal.dll) Version: 26.4
Syntax
public struct Color : IEquatable<Color>

The Color type exposes the following members.

Properties
 NameDescription
Public propertyAThe alpha component (0 = fully transparent, 255 = fully opaque).
Public propertyBThe blue component (0–255).
Public propertyStatic memberBlackPure black (#000000).
Public propertyStatic memberBluePure blue (#0000FF).
Public propertyStatic memberCyanPure cyan (#00FFFF).
Public propertyStatic memberDarkGrayDarkGray (#A9A9A9).
Public propertyGThe green component (0–255).
Public propertyStatic memberGrayStandard gray (#808080).
Public propertyStatic memberGreenPure green (#008000).
Public propertyIsEmptyTrue if this is the default (uninitialized) value of Color.
Public propertyStatic memberLightGrayLightGray (#D3D3D3).
Public propertyStatic memberMagentaPure magenta (#FF00FF).
Public propertyStatic memberOrangeOrange (#FFA500).
Public propertyRThe red component (0–255).
Public propertyStatic memberRedPure red (#FF0000).
Public propertyStatic memberTransparentA fully transparent color (A=0).
Public propertyStatic memberWhitePure white (#FFFFFF).
Public propertyStatic memberYellowPure yellow (#FFFF00).
Top
Methods
 NameDescription
Public methodEquals(Color)Indicates whether this color and the specified Color have the same ARGB value.
Public methodEquals(Object)Indicates whether this color and the specified object have the same value.
(Overrides ValueTypeEquals(Object))
Public methodStatic memberFromArgb(Int32) Constructs a color from a raw 32-bit ARGB value (layout: AARRGGBB).
Public methodStatic memberFromArgb(Int32, Color) Constructs a color by replacing the alpha component of an existing color.
Public methodStatic memberFromArgb(Int32, Int32, Int32) Constructs a fully-opaque color from the given red/green/blue components.
Public methodStatic memberFromArgb(Int32, Int32, Int32, Int32) Constructs a color with the given alpha/red/green/blue components. Each value is clamped to 0–255.
Public methodGetHashCodeReturns the hash code for this color.
(Overrides ValueTypeGetHashCode)
Public methodToArgbGets the raw 32-bit ARGB value (layout: AARRGGBB).
Public methodToStringReturns a string representation of this Color (its A, R, G and B components).
(Overrides ValueTypeToString)
Top
Operators
 NameDescription
Public operatorStatic memberEquality(Color, Color)Returns true if the two colors have identical ARGB values.
Public operatorStatic memberInequality(Color, Color)Returns true if the two colors have different ARGB values.
Top
Fields
 NameDescription
Public fieldStatic memberEmpty 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.
Example
SelectPdf.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;
See Also