R/aaa_uc_brand.R

Defines functions .uc_font_family .uc_table_stripe .uc_highlight_fill .uc_ribbon_fill .uc_reference_color .uc_border_color .uc_grid_color .uc_plot_palette .uc_text_color .uc_color

.uc_brand_colors <- c(
  "UC Red" = "#E00122",
  "UC Dark Red" = "#B8011C",
  "Black" = "#000000",
  "White" = "#FFFFFF",
  "Grey" = "#F3F3F3",
  "Bearcats Black" = "#333333",
  "Calhoun Maroon" = "#890519",
  "Steger Silver" = "#A7A5AA",
  "Main Street Mist" = "#D8D5D0",
  "Gettler Gold" = "#D1B179",
  "Tangeman Tan" = "#EADBC1"
)

.uc_plot_colors <- .uc_brand_colors[c(
  "UC Red",
  "UC Dark Red",
  "Bearcats Black",
  "Gettler Gold",
  "Calhoun Maroon",
  "Steger Silver",
  "Tangeman Tan"
)]

.uc_font_candidates <- list(
  display = c("Jost", "Arial", "sans"),
  sans = c("Open Sans", "Arial", "sans"),
  serif = c("Gentium Book Basic", "Georgia", "serif"),
  mono = c("JetBrains Mono", "Fira Code", "Consolas", "monospace")
)

.uc_color <- function(name) {
  unname(.uc_brand_colors[[name]])
}

.uc_text_color <- function() {
  .uc_color("Bearcats Black")
}

.uc_plot_palette <- function() {
  .uc_plot_colors
}

.uc_grid_color <- function(alpha = 1) {
  scales::alpha(colorspace::darken(.uc_color("Grey"), 0.12), alpha)
}

.uc_border_color <- function(alpha = 1) {
  scales::alpha(colorspace::darken(.uc_color("Main Street Mist"), 0.12), alpha)
}

.uc_reference_color <- function(alpha = 1) {
  scales::alpha(colorspace::darken(.uc_color("Steger Silver"), 0.18), alpha)
}

.uc_ribbon_fill <- function(alpha = 0.28) {
  scales::alpha(.uc_color("Steger Silver"), alpha)
}

.uc_highlight_fill <- function(alpha = 0.38) {
  scales::alpha(.uc_color("Tangeman Tan"), alpha)
}

.uc_table_stripe <- function() {
  .uc_color("Grey")
}

.uc_font_family <- function(role = c("display", "sans", "serif", "mono")) {
  role <- match.arg(role)
  candidates <- .uc_font_candidates[[role]]

  if (.Platform$OS.type == "windows") {
    windows_safe <- c(
      display = "sans",
      sans = "sans",
      serif = "serif",
      mono = "mono"
    )
    return(unname(windows_safe[[role]]))
  }

  if (requireNamespace("systemfonts", quietly = TRUE)) {
    available <- unique(tolower(stats::na.omit(systemfonts::system_fonts()$family)))

    for (candidate in utils::head(candidates, -1)) {
      if (tolower(candidate) %in% available) {
        return(candidate)
      }
    }
  }

  candidates[[length(candidates)]]
}

Try the Rbearcat package in your browser

Any scripts or data that you put into this service are public.

Rbearcat documentation built on March 21, 2026, 5:07 p.m.