Skip to contents

fill is the common representation stored in style()'s fill property and canvas()'s background property: a value (a plain colour string, or the GridPattern output of a fill_*() pattern/ gradient helper) plus an optional resolve function. resolve, when present, is called with the real target's own bounding-box aspect ratio at draw() time to rebuild value with the correct tile shape – see the internal resolvable_fill()/resolve_fill() helpers (R/fill.R), and fill_hatch()'s own aspect argument docs for the problem this solves. resolve is NULL whenever a helper's aspect was supplied explicitly (a fixed aspect, never automatically recomputed) or for a fill with no aspect-dependence at all (fill_solid(), fill_none()).

Usage

fill(value = "black", resolve = NULL)

Arguments

value

A plain colour string, or a GridPattern object (the output of grid::pattern(), as returned by every fill_*() helper besides fill_solid()/fill_none()). Default "black".

resolve

NULL, or a function of one argument (aspect) rebuilding value for a newly-known target aspect ratio. Default NULL.

Details

Not usually constructed directly – every fill_*() helper already returns one, and style()/canvas() coerce a bare colour string or GridPattern into one automatically (via the internal as_fill() helper) if passed directly.