Struct PdfColor
- Namespace
- SoftZenPdf
- Assembly
- SoftZenPdf.dll
An RGB colour with components from 0 to 1, written to PDF as DeviceRGB.
public readonly record struct PdfColor : IEquatable<PdfColor>
- Implements
- Inherited Members
Examples
var brand = PdfColor.FromHex("#864FFE");
var grey = new PdfColor(0.5, 0.5, 0.5);
Constructors
- PdfColor(double, double, double)
Creates a colour from components between 0 and 1.
Properties
- B
Blue component, 0–1.
- Black
Black (0, 0, 0).
- Blue
Pure blue (0, 0, 1).
- G
Green component, 0–1.
- Gray
Mid grey (0.5, 0.5, 0.5).
- Green
Pure green (0, 1, 0).
- R
Red component, 0–1.
- Red
Pure red (1, 0, 0).
- White
White (1, 1, 1).
Methods
- FromHex(string)
Parses a CSS-style hex colour.
- FromRgb(byte, byte, byte)
Creates a colour from 8-bit components (0–255).