#[non_exhaustive]pub struct ElementGeom {
pub ink: Option<(u8, u8, u8)>,
pub paper: Option<(u8, u8, u8)>,
pub accent: Option<(u8, u8, u8)>,
pub family: Option<String>,
}Expand description
Geom “ink”/“paper”/“accent” palette (ggplot2 4.0’s element_geom,
B2-7): recolours a geom’s built-in default colour without touching
every geom’s own color/fill field or needing a mapped/explicit colour
to be set first. None everywhere (the default) changes nothing —
byte-identical output. Marked #[non_exhaustive] so a later field can
be added without an ..Default::default() break.
A default Geom::apply_element_geom
is a no-op; a geom that honours this overrides it, replacing only
fields still at their own built-in default — called once per layer,
before the brand Theme::primary colour is
applied, and (like the brand colour) only for a layer that was not
configured explicitly via geom_*_with(...): that is the actual guard
against touching an explicit colour (an explicit_style gate in the
build pipeline), not a comparison of the field’s value against the
hard-coded default, which can’t otherwise tell an explicitly-set black
apart from a black nobody touched.
Geoms covered: GeomPoint, GeomLine, GeomPath, GeomText,
GeomLabel, GeomBoxplot, GeomSegment, GeomCurve, the reference
lines (GeomHline/GeomVline/GeomAbline), GeomErrorbar/
GeomErrorbarh/GeomLinerange/GeomPointrange, GeomStep, the
outline colour of GeomRect/GeomTile/GeomBar/GeomCol/
GeomPolygon/GeomViolin/GeomDensity/GeomArea/GeomCount/
GeomHex/GeomContour/GeomHistogram/GeomDensity2d/GeomBin2d/
GeomSf (feature sf), GeomCrossbar, GeomTextRepel,
GeomLabelRepel, GeomSpoke, GeomRug, GeomBracket, GeomJitter,
GeomQQ, GeomCensorMarks and GeomFreqpoly (ink for a black/
(50, 50, 50) line, text or outline; paper for a white fill, on
GeomBoxplot/GeomLabel/GeomCrossbar/GeomLabelRepel) and
GeomSmooth (accent for its default blue line and ribbon fill) —
plus the legend key swatch colour, which reads ink directly rather
than going through this trait method. A handful of geoms are left
uncovered on purpose: GeomDotplot’s color field is dead config
(never drawn); GeomQQLine/GeomCandlestick/GeomOhlc’s defaults are
deliberate semantic colours, not neutral ones; GeomQQBand’s mid-grey
fill doesn’t match this type’s black/white checks; and
GeomCalendarBorder already reads its colour from the dedicated
Theme::calendar_month_border
element. See sipemu/ggplot-rs#142.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.ink: Option<(u8, u8, u8)>Replaces a geom’s built-in black / (50, 50, 50) line, text or
outline colour (including the legend key colour).
paper: Option<(u8, u8, u8)>Replaces a geom’s built-in white fill.
accent: Option<(u8, u8, u8)>Replaces the smooth line’s built-in colour.
family: Option<String>Font family — the middle tier of B2-6’s resolution order
(a geom’s own fontfamily, then this, then theme.text.family).
Implementations§
Trait Implementations§
Source§impl Clone for ElementGeom
impl Clone for ElementGeom
Source§impl Debug for ElementGeom
impl Debug for ElementGeom
Auto Trait Implementations§
impl Freeze for ElementGeom
impl RefUnwindSafe for ElementGeom
impl Send for ElementGeom
impl Sync for ElementGeom
impl Unpin for ElementGeom
impl UnsafeUnpin for ElementGeom
impl UnwindSafe for ElementGeom
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more