data-raw/colors.r

# Define Base Colors

# Colors from UNHCR dataviz guidelines
unhcrcolors <- list(
  blue = "#0072BC",
  white = "#FFFFFF",
  black = "#000000",
  yellow = "#FAEB00",
  grey = "#666666",
  navy = "#18375F",
  green = "#00B398",
  red = "#EF4A60",
  lightblue = "#DCE9FF",
  mediumblue = "#8EBEFF",
  darkblue = "#044F85",
  lightgrey = "#E6E6E6",
  mediumgrey = "#CCCCCC",
  darkgrey = "#222222",
  lightyellow = "#FFF9CB",
  mediumyellow = "#FFF483",
  darkyellow = "#E1CC0D"
)

# Generate color_variables.css

css_colors <- paste0("  --unhcr-", names(unhcrcolors), ": ", unname(unlist(unhcrcolors)), ";")

warning <- "/*! This file is autogenerated in data-raw/colors.R Do not manually edit */"

fileConn <- file("inst/resources/css/color_variables.css")
writeLines(c(warning, ":root {", css_colors, "}"), fileConn)
close(fileConn)

# Generate SCSS variables

scss_colors <- paste0("$unhcr-", names(unhcrcolors), ": ", unname(unlist(unhcrcolors)), ";")

warning <- "// This file is autogenerated in data-raw/colors.R. Do not manually edit"

fileConn <- file("data-raw/scss/_colors.scss")
writeLines(c(warning, scss_colors), fileConn)
close(fileConn)
vidonne/unhcrdown documentation built on June 1, 2025, 11:02 p.m.