data-raw/gen_unhcr_colors.R

# Define Base UNHCR Colors ------------------------------------------------------

# Colors last updated on 2019-12-21
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"
)


# Write color_variables.css ------------------------------------------

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

warning <-
  "/*! This file is autogenerated in data-raw/gen_unhcr_colors.R. Do not manually edit */
/*! =========================================================
@name             color_variables.css
@description      UNHCR color variables
@lastUpdated      22.12.2021
============================================================= */
"

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


# Generate SASS variables -------------------------------------------------

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

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


fileConn <- file("inst/resources/scss/_unhcrcolors.scss")
writeLines(c(warning, scss_colors), fileConn)
close(fileConn)
vidonne/unhcrdesign documentation built on Jan. 17, 2022, 12:07 p.m.