Skip to content

Instantly share code, notes, and snippets.

@charliejhadley
Created April 22, 2025 13:38
Show Gist options
  • Select an option

  • Save charliejhadley/6877b4bd9db47de1b206063d2a5e5861 to your computer and use it in GitHub Desktop.

Select an option

Save charliejhadley/6877b4bd9db47de1b206063d2a5e5861 to your computer and use it in GitHub Desktop.
Recolouring the R logo
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
library("tidyverse")
library("rsvg")
rlogo_original_chr <- readLines("r-logo_original.svg")
col_rlogo_ring_light <- "#cbced0"
col_rlogo_ring_dark <- "#84838b"
col_rlogo_rletter_light <- "#276dc3"
col_rlogo_rletter_dark <- "#165caa"
make_new_r_logo <- function(ring_light, ring_dark, letter_light, letter_dark){
original_colours <- c(col_rlogo_ring_light, col_rlogo_ring_dark, col_rlogo_rletter_light, col_rlogo_rletter_dark)
vec_replacements <- setNames(c(ring_light, ring_dark, letter_light, letter_dark), original_colours)
str_replace_all(rlogo_original_chr, vec_replacements)
}
make_new_r_logo("#30CED1", "#105052", "#30CED1", "#D13BA4") %>%
writeLines("r-logo_graph_colours.svg")
make_new_r_logo("#30CED1", "#105052", "#30CED1", "#D13BA4") %>%
charToRaw() %>%
rsvg_png(file = "r-logo_graph_colours.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment