
The goal of {brandthis} is to quickly get you started with creating:
-
_brand.ymlfile
-
ggplot2color scales and palettes
for your theming and visualization needs.
_brand.yml helps you consistently theme your rmarkdown, quarto, and shiny products by specifying colors, fonts, logos, and other information in one file.
Installation
You can install the development version of {brandthis} from GitHub with:
# install.packages("remotes")
remotes::install_github("durraniu/brandthis")NOTE: {brandthis} is currently not compatible with
ggplot2version 4.0.0. Please use an earlier version.
Getting Started
{brandthis} uses LLM APIs for generating _brand.yml and color palettes/scales. So, you need an API key from your favourite LLM provider. You can find the supported APIs on the ellmer website.
Grab your API key (e.g., GOOGLE_API_KEY, OPENROUTER_API_KEY, etc.) and put it in your .Renviron file.
Examples
{brandthis} has three main functions:
-
brandthis::create_brand()creates a_brand.ymlfor personal or company branding:
# Provide your details in the prompt and optionally an image for extracting colors:
personal_brand <- brandthis::create_brand(
prompt = "My name is John Doe.",
img = "https://free-images.com/md/e150/eugene_louis_boudin_venice.jpg",
type = "personal",
chat_fn = ellmer::chat_github
)
# Provide multiple screenshots of company branding guidelines:
company_brand <- brandthis::create_brand(
"Company name is Walmart",
img = c("walmart-font.png",
"walmart-palette.jpeg",
"walmart-logo.png"),
type = "company",
chat_fn = ellmer::chat_google_gemini
)-
brandthis::suggest_color_scales()suggests ggplot2 color scales that have palette colours similar to the color palette in the provided_brand.ymlfile. Suggestion is made by retrieving the relevant info. from a knowledge store for thepaletteerorggscipackages. The knowledge store is downloaded the first timesuggest_color_scalesis used:
suggested_scales <- brandthis::suggest_color_scales(personal_brand, "paletteer")-
brandthis::create_color_palette()creates a list of discrete, sequential, and diverging colour palettes from the colour palette in the provided_brand.yml:
color_palettes <- brandthis::create_color_palette(personal_brand)createBranding App
{brandthis} comes with a shiny app that lets you generate the _brand.yml and color palettes with the benefit of reviewing the results in the app. You can launch the app by running run_brand_app():

The createBranding app is built on the brand.yml app available in bslib and can be launched by running shiny::runExample("brand.yml", package = "bslib").
Acknowledgements
All the credit goes to the creators of ggplot2, shiny, bslib, brand.yml, quarto, ragnar, ellmer, and several other packages that made brandthis possible. I am very thankful to Garrick Aden-Buie for not only creating the awesome packages and documentation, but also patiently answering my questions on Discord, GitHub Discussions and issues. I am also very grateful to Tomasz Kalinowski whose quartohelp R package showed me how to release knowledge stores on GitHub and make them useful to brandthis users. I adapted several of quartohelp store-related functions for brandthis (see R/store.R in the package source).
