Skip to content

Commit

Permalink
adding better png logo versions (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielinteractive committed Dec 11, 2023
1 parent a883751 commit cf23561
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions design/create_hex_logo.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pkg_color <- "red"
fill_color <- "lightgrey"
out_path <- file.path(getwd(), "man/figures/logo-large.png")
out_path <- file.path(getwd(), "man/figures/logo-large")
out_file <- paste(out_path, "png", sep = ".")

idm_plot <- function() {
prodlim::plotIllnessDeathModel(
Expand All @@ -16,9 +17,9 @@ idm_plot <- function() {
}
idm_plot()

idm_fig <- file.path(tmp, "idm_plot.png")
tmp <- tempdir()
png(filename = idm_fig, res = 200, width = 500, height = 500, bg = "transparent")
idm_fig <- file.path(tmp, "idm_plot.png")
png(filename = idm_fig, res = 100, width = 500, height = 500, bg = "transparent")
idm_plot()
dev.off()

Expand All @@ -44,12 +45,19 @@ make_hexplot <- function() {
url = "github.com/insightsengineering/simIDM",
u_size = 24,
u_color = pkg_color,
filename = out_path,
filename = out_file,
p_family = "mono",
# We need this white around sticker, otherwise the top and bottom of the
# hexagon are not nice (too flat).
white_around_sticker = TRUE,
dpi = 2000
)
# But therefore we now need to postprocess the image by transforming white
# to transparent background.
out_img <- magick::image_read(out_file)
out_img <- magick::image_transparent(out_img, color = "white")
magick::image_write(out_img, path = out_file)
}

make_hexplot()
usethis::use_logo(out_path)
usethis::use_logo(out_file)
Binary file modified man/figures/logo-large.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cf23561

Please sign in to comment.