Generates a publication-ready hexagon sticker for an R package.
Returns a ggplot object that can be printed, further customised with +,
or saved with save_hex().
Usage
hex_sticker(
name = "package",
subtitle = NULL,
url = NULL,
icon = NULL,
icon_image = NULL,
icon_size = 1,
theme = "stats",
mode = "dark",
bg = NULL,
accent = NULL,
text_color = NULL,
border_color = NULL,
sub_color = NULL,
font_family = "mono",
font_bold = TRUE,
font_italic = FALSE,
font_size = 12,
border_width = 2,
inner_border = TRUE,
filename = NULL,
width = 600,
dpi = 300
)Arguments
- name
Character. The package name displayed on the sticker.
- subtitle
Character or
NULL. Optional subtitle shown below the package name.- url
Character or
NULL. Optional URL shown near the bottom of the sticker.- icon
Character or
NULL. Name of a built-in icon. Seehexmakr_icons()for valid values. Ignored ificon_imageis provided.- icon_image
Character or
NULL. Path to a custom image file (PNG or JPEG). If provided, overridesiconand retains the image proportions. Images must be at most 10 MiB, 8192 pixels per side and 16 million pixels in total. Invalid or oversized images report an error before rendering.- icon_size
Numeric. Size multiplier for the icon (default
1.0).- theme
Character. Theme name. One of
names(hexmakr_themes()). The nine CTTIR v5 families (for example"spatial"or"clinical") are listed first and are the house standard; for complete v5 artwork usehex_design(). Default"stats".- mode
Character. Colour mode, either
"dark"(default) or"light".- bg
Character or
NULL. Override the background colour (hex string, e.g."#1B2838").- accent
Character or
NULL. Override the accent colour.- text_color
Character or
NULL. Override the text colour.- border_color
Character or
NULL. Override the border colour.- sub_color
Character or
NULL. Override the subtitle/URL colour.- font_family
Character. Font shorthand (e.g.
"mono","serif","sans") or a system font name. Default"mono"."jetbrains_mono"uses the JetBrains Mono font bundled for CTTIR v5 names, drawn as glyph outlines so it needs no installed font (bold uses the semibold cut; italic is slanted). Unsupported bundled-font characters report an error.- font_bold
Logical. Use bold weight. Default
TRUE.- font_italic
Logical. Use italic style. Default
FALSE.- font_size
Numeric. Base font size in pt for the package name. Default
12.- border_width
Numeric. Border line width in mm. Default
2.- inner_border
Logical. Draw a thin inner accent ring. Default
TRUE.- filename
Character or
NULL. If provided, save the sticker as a transparent PNG at this path usingsave_hex().- width
Integer. Export width in pixels (height is derived from the hex aspect ratio). Default
600.- dpi
Numeric. Resolution for PNG export. Default
300.
See also
hexmakr_themes(), hexmakr_icons(), save_hex(),
hexmakr_app()
Other stickers:
hexmakr_app(),
save_hex(),
save_hex_svg()
Examples
# Minimal sticker
hex_sticker("mypackage")
# With icon and theme
hex_sticker("mypackage", icon = "dna", theme = "genomics")
# CTTIR v5 family colours and the bundled v5 name font
hex_sticker("mypackage", icon = "microscope", theme = "spatial",
font_family = "jetbrains_mono")
# Save to file
tmp <- tempfile(fileext = ".png")
hex_sticker("mypackage", icon = "atom", theme = "stats", filename = tmp)
file.exists(tmp)
#> [1] TRUE