Skip to content

Commit 20f39a6

Browse files
Add hex sticker logo
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c63c17b commit 20f39a6

4 files changed

Lines changed: 65 additions & 0 deletions

File tree

data-raw/make_hexsticker.R

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Generate hex sticker for non-package repo
2+
# Edit package_name below for this repo
3+
4+
if (!requireNamespace("pak", quietly = TRUE)) {
5+
install.packages("pak")
6+
}
7+
8+
if (!requireNamespace("hexSticker", quietly = TRUE)) {
9+
pak::pkg_install("hexSticker")
10+
}
11+
12+
library(hexSticker)
13+
14+
package_name <- "stac_dem_bc"
15+
16+
logo_url <- "https://raw.githubusercontent.com/NewGraphEnvironment/new_graphiti/main/assets/logos/logo_newgraph/WHITE/PNG/nge-icon_white.png"
17+
logo_file <- "data-raw/nge-icon_white.png"
18+
output_file <- "man/figures/logo.png"
19+
20+
if (!file.exists(logo_file)) {
21+
dir.create(dirname(logo_file), recursive = TRUE, showWarnings = FALSE)
22+
download.file(logo_url, logo_file, mode = "wb")
23+
}
24+
25+
dir.create(dirname(output_file), recursive = TRUE, showWarnings = FALSE)
26+
27+
# Scale font size by name length
28+
p_size <- if (nchar(package_name) <= 3) 24 else if (nchar(package_name) <= 6) 18 else if (nchar(package_name) <= 10) 14 else 10
29+
30+
sticker(
31+
subplot = logo_file,
32+
package = package_name,
33+
s_x = 1, s_y = 1.15,
34+
s_width = 0.45, s_height = 0.45,
35+
p_size = p_size,
36+
p_x = 1, p_y = 0.50,
37+
p_color = "white",
38+
p_family = "Helvetica",
39+
h_fill = "black",
40+
h_color = "white",
41+
h_size = 1.2,
42+
filename = output_file,
43+
dpi = 300
44+
)
45+
46+
message(package_name, " hex sticker -> ", output_file)
47+
48+
# Smaller version
49+
sticker(
50+
subplot = logo_file,
51+
package = package_name,
52+
s_x = 1, s_y = 1.05,
53+
s_width = 0.45, s_height = 0.45,
54+
p_size = p_size,
55+
p_x = 1, p_y = 0.58,
56+
p_color = "white",
57+
p_family = "Helvetica",
58+
h_fill = "black",
59+
h_color = "white",
60+
h_size = 1.2,
61+
filename = "man/figures/logo_small.png",
62+
dpi = 150
63+
)
64+
65+
message(package_name, " small logo -> man/figures/logo_small.png")

data-raw/nge-icon_white.png

9.01 KB
Loading

man/figures/logo.png

27.4 KB
Loading

man/figures/logo_small.png

13.6 KB
Loading

0 commit comments

Comments
 (0)