Skip to content

Commit

Permalink
Refactor logo generation script
Browse files Browse the repository at this point in the history
  • Loading branch information
nanxstats committed Oct 21, 2024
1 parent d496fc1 commit 969a0d6
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
Binary file modified docs/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 16 additions & 4 deletions docs/scripts/logo.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
sysfonts::font_add_google("Zilla Slab", "pf", regular.wt = 500)

hexSticker::sticker(
subplot = ~ plot.new(), s_x = 1, s_y = 1, s_width = 0.1, s_height = 0.1,
package = "tinytopics", p_x = 1, p_y = 1, p_size = 26, h_size = 1.2, p_family = "pf",
p_color = "#3F8CCC", h_fill = "#FFF9F2", h_color = "#3F8CCC",
dpi = 320, filename = "docs/assets/logo.png"
subplot = ~ plot.new(),
s_x = 1,
s_y = 1,
s_width = 0.1,
s_height = 0.1,
package = "tinytopics",
p_x = 1,
p_y = 1,
p_size = 26,
h_size = 1.2,
p_family = "pf",
p_color = "#3F8CCC",
h_fill = "#FFF9F2",
h_color = "#3F8CCC",
dpi = 320,
filename = "docs/assets/logo.png"
)
24 changes: 23 additions & 1 deletion docs/scripts/logo.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
#!/bin/bash

# Generate logo
Rscript docs/scripts/logo.R
pngquant docs/assets/logo.png --force --output docs/assets/logo.png
if [ -f "Rplots.pdf" ]; then
rm Rplots.pdf
fi

# Optimize PNG
pngquant docs/assets/logo.png \
--force \
--output docs/assets/logo.png

# Pad the logo to get square favicon and resize
magick docs/assets/logo.png \
-gravity center \
-background none \
-extent 640x640 \
-resize 512x512 \
docs/assets/favicon.png

# Optimize PNG
pngquant docs/assets/favicon.png \
--force \
--output docs/assets/favicon.png

0 comments on commit 969a0d6

Please sign in to comment.