Skip to contents

Automates the tedious process of setting up package branding assets. Use this when initializing a new R package or Quarto site to ensure consistent Artalytics branding without manual file downloads or favicon generation.

The function auto-detects project type based on config files, downloads the logo, and generates a complete favicon set via the realfavicongenerator.net API.

Usage

setup_favicon(
  pkg = ".",
  url = "https://cdn.artalytics.art/assets/logo/logo-core-128w-v48b04112.png",
  overwrite = FALSE,
  quiet = FALSE
)

Arguments

pkg

Character. Path to project root directory containing _pkgdown.yml or _quarto.yml. Defaults to current directory ("."). The directory must exist and contain exactly one of the supported config files. Use absolute paths when calling from scripts outside the project directory.

url

Character. URL of the logo image to download (PNG or SVG format). Defaults to the Artalytics CDN logo. For custom branding, provide a direct URL to a square image (minimum 128x128px recommended for favicon quality). The URL must be publicly accessible.

overwrite

Logical. Whether to re-download the logo and regenerate all favicons even if they already exist. Default FALSE skips existing files. Set to TRUE when updating branding or fixing corrupted assets.

quiet

Logical. Whether to suppress progress messages during download and favicon generation. Default FALSE shows status messages. Set to TRUE for non-interactive scripts or CI pipelines.

Value

Character (invisible). The absolute path to the downloaded logo file. Useful for verification or subsequent operations on the logo.

Details

Project type detection:

  • pkgdown: _pkgdown.yml present → logo to man/figures/logo.png, favicons to pkgdown/favicon/

  • Quarto: _quarto.yml present → logo to www/assets/logo/logo.png, favicons to www/assets/favicon/

Requirements:

  • Package {openssl} must be installed for favicon generation

  • Internet connection required for logo download and API call

  • Project must have either _pkgdown.yml or _quarto.yml (not both)

See also

Other pkg-dev: screenshot_app()

Examples

if (FALSE) { # \dontrun{
# Auto-detect project type and setup favicon
setup_favicon()

# Force regeneration
setup_favicon(overwrite = TRUE)

# Custom logo URL
setup_favicon(url = "https://example.com/logo.png")
} # }