PeachPDF

PeachPDF

PdfColor Struct

An RGBA color for the declarative document-building API (CreateDocument(Action<IDocumentBuilder>, PdfGenerateConfig)). Deliberately not System.Drawing.PaintColor - that assembly isn’t available/trim-friendly on every target this library supports (WebAssembly, NativeAOT). Internally formats to a canonical rgb()/rgba() CSS color token, resolved by PeachPDF’s own existing CSS color parser at layout time - not a new, independent color implementation.

public readonly struct PdfColor
Properties  
A The alpha (opacity) channel, 0-255 (255 = fully opaque).
B The blue channel, 0-255.
Black Opaque black.
Blue Opaque blue.
G The green channel, 0-255.
Gray Opaque gray.
Green Opaque green.
R The red channel, 0-255.
Red Opaque red.
Transparent Fully transparent black.
White Opaque white.
Methods  
FromArgb(byte, byte, byte, byte) Creates a color from its alpha/red/green/blue channels.
FromHex(string) Parses a hex color: #RGB, #RGBA, #RRGGBB, or #RRGGBBAA (the leading # is optional).
FromRgb(byte, byte, byte) Creates a fully opaque color from its red/green/blue channels.
ToString() Returns the canonical rgb()/rgba() CSS color token this value represents.