PDFiumVCL Docs

HighlightColor property

Component: TPdfView  ·  Unit: PDFium
Color of the rectangle painted over each match returned by HighlightSearchText. Defaults to clYellow; published so applications can theme the highlight.

Syntax

property HighlightColor: TColor;

Description

HighlightColor is the brush color the view uses when painting the search-result mask over every match found by HighlightSearchText. The mask is overlaid on each redraw, on top of the rendered PDF page, so the highlight visibly tracks scrolling and zoom without re-running the search.

The default value is clYellow — the convention every mainstream PDF reader uses for find-in-page highlights. The property is published so applications can theme the color to match their UI palette without subclassing TPdfView (a deep amber for a sepia reader theme; a soft cyan for a dark-mode viewer).

HighlightColor is the only styling knob for the overlay — the mask is a flat color fill behind the text, intentionally simple so that highlight rectangles never obscure glyph anti- aliasing. For multi-colored highlights (different colors per match / per query / per page), use a custom OnPaint handler instead of HighlightSearchText.

Remarks

Example

// Theme the highlight to match a dark reader UI
PdfView1.HighlightColor := $00FFFF66; // pale yellow
PdfView1.HighlightSearchText('invoice', False, True);

// Round-trip via the Object Inspector default
PdfView1.HighlightColor := clYellow;

See Also

HighlightSearchText, ClearHighlight, FindFirst