Created
April 22, 2025 13:38
-
-
Save charliejhadley/6877b4bd9db47de1b206063d2a5e5861 to your computer and use it in GitHub Desktop.
Recolouring the R logo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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