npx claudepluginhub choxos/rpkgagent --plugin r-package-developmentThis skill uses the workspace's default tool permissions.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Delivers DB-free sandbox API regression tests for Next.js/Vitest to catch AI blind spots in self-reviewed code changes like API routes and backend logic.
This skill covers creating professional hexagonal package logos using the hexSticker package. Hex logos are the standard branding for R packages, featured on package websites, GitHub repos, and CRAN pages.
# Install hexSticker and dependencies
install.packages("hexSticker")
install.packages("showtext") # For Google Fonts
install.packages("ggplot2") # For custom plots
install.packages("magick") # For image manipulation
# Load packages
library(hexSticker)
library(showtext)
library(ggplot2)
These are set automatically by hexSticker.
library(hexSticker)
sticker(
# Required: subplot (can be empty plot)
subplot = ~ plot.new(),
# Package name
package = "mypackage",
# Package name styling
p_size = 20, # Font size
p_color = "#FFFFFF", # White text
# Hex styling
h_fill = "#0054AD", # Fill color
h_color = "#000000", # Border color
# Output
filename = "man/figures/logo.png"
)
library(hexSticker)
# Using an existing image
img_path <- "man/figures/icon.png"
sticker(
subplot = img_path,
s_x = 1, # Center horizontally
s_y = 0.75, # Position vertically
s_width = 0.6, # Image width
s_height = 0.6, # Image height
package = "mypackage",
p_size = 20,
p_y = 1.45, # Position below image
p_color = "#FFFFFF",
h_fill = "#0054AD",
h_color = "#000000",
filename = "man/figures/logo.png"
)
library(hexSticker)
library(ggplot2)
# Create a plot
p <- ggplot(mtcars, aes(mpg, wt)) +
geom_point(color = "white", size = 2) +
theme_void() +
theme_transparent()
# Create sticker
sticker(
subplot = p,
s_x = 1,
s_y = 0.85,
s_width = 1.3,
s_height = 1,
package = "mypackage",
p_size = 20,
p_y = 1.5,
p_color = "#FFFFFF",
h_fill = "#0054AD",
h_color = "#FFFFFF",
h_size = 1.5,
filename = "man/figures/logo.png",
dpi = 300
)
library(hexSticker)
library(showtext)
# Add Google Fonts
font_add_google("Fira Sans", "firasans")
font_add_google("Fira Code", "firacode")
# Enable showtext
showtext_auto()
# Create sticker with custom font
sticker(
subplot = ~ plot.new(),
package = "mypackage",
p_size = 24,
p_family = "firasans", # Use Google Font
p_fontface = "bold",
p_color = "#FFFFFF",
h_fill = "#0054AD",
h_color = "#000000",
filename = "man/figures/logo.png",
dpi = 300
)
# Modern and clean
font_add_google("Inter", "inter")
font_add_google("JetBrains Mono", "jetbrains")
# Professional
font_add_google("Roboto", "roboto")
font_add_google("Roboto Slab", "robotoslab")
# Friendly
font_add_google("Nunito", "nunito")
font_add_google("Quicksand", "quicksand")
# Technical
font_add_google("Fira Sans", "firasans")
font_add_google("Fira Code", "firacode")
# Elegant
font_add_google("Lato", "lato")
font_add_google("Merriweather", "merriweather")
# Bold/Impact
font_add_google("Montserrat", "montserrat")
font_add_google("Bebas Neue", "bebas")
#!/usr/bin/env Rscript
# Hex sticker generation script for mypackage
# Run this script to regenerate the package logo
# Load required packages
library(hexSticker)
library(showtext)
library(ggplot2)
# Configuration
PACKAGE_NAME <- "mypackage"
OUTPUT_DIR <- "man/figures"
# Ensure output directory exists
if (!dir.exists(OUTPUT_DIR)) {
dir.create(OUTPUT_DIR, recursive = TRUE)
}
# Add and configure fonts
font_add_google("Fira Sans", "firasans")
showtext_auto()
# Color scheme (adjust to match your package theme)
FILL_COLOR <- "#0054AD" # Primary brand color
BORDER_COLOR <- "#000000" # Black border
TEXT_COLOR <- "#FFFFFF" # White text
ACCENT_COLOR <- "#FFA500" # Orange accent
# Option 1: Text-only logo
# Uncomment to use
# sticker(
# subplot = ~ plot.new(),
# package = PACKAGE_NAME,
# p_size = 24,
# p_family = "firasans",
# p_fontface = "bold",
# p_color = TEXT_COLOR,
# p_y = 1,
# h_fill = FILL_COLOR,
# h_color = BORDER_COLOR,
# h_size = 1.5,
# filename = file.path(OUTPUT_DIR, "logo.png"),
# dpi = 300
# )
# Option 2: Logo with ggplot2 visualization
# Create a representative plot
set.seed(123)
plot_data <- data.frame(
x = rnorm(100),
y = rnorm(100)
)
p <- ggplot(plot_data, aes(x, y)) +
geom_point(color = TEXT_COLOR, alpha = 0.6, size = 1.5) +
geom_density_2d(color = ACCENT_COLOR, size = 0.8) +
theme_void() +
theme_transparent() +
theme(
legend.position = "none",
panel.background = element_rect(fill = "transparent", color = NA),
plot.background = element_rect(fill = "transparent", color = NA)
)
# Create sticker with plot
sticker(
subplot = p,
s_x = 1,
s_y = 0.85,
s_width = 1.4,
s_height = 1.1,
package = PACKAGE_NAME,
p_size = 20,
p_family = "firasans",
p_fontface = "bold",
p_color = TEXT_COLOR,
p_y = 1.5,
h_fill = FILL_COLOR,
h_color = BORDER_COLOR,
h_size = 1.5,
url = "github.com/username/mypackage",
u_size = 3.5,
u_color = TEXT_COLOR,
u_family = "firasans",
filename = file.path(OUTPUT_DIR, "logo.png"),
dpi = 300
)
# Also generate SVG version
sticker(
subplot = p,
s_x = 1,
s_y = 0.85,
s_width = 1.4,
s_height = 1.1,
package = PACKAGE_NAME,
p_size = 20,
p_family = "firasans",
p_fontface = "bold",
p_color = TEXT_COLOR,
p_y = 1.5,
h_fill = FILL_COLOR,
h_color = BORDER_COLOR,
h_size = 1.5,
url = "github.com/username/mypackage",
u_size = 3.5,
u_color = TEXT_COLOR,
u_family = "firasans",
filename = file.path(OUTPUT_DIR, "logo.svg")
)
message("Logo generated successfully:")
message(" PNG: ", file.path(OUTPUT_DIR, "logo.png"))
message(" SVG: ", file.path(OUTPUT_DIR, "logo.svg"))
chmod +x man/figures/generate_logo.R
Add to .Rbuildignore:
^man/figures/generate_logo\.R$
Or use usethis:
usethis::use_build_ignore("man/figures/generate_logo.R")
Brand colors: Match your organization/project colors
Contrast: Ensure text is readable on background
Color theory:
# Tidyverse style (blue and green)
h_fill = "#1881C2"
h_color = "#87B13F"
p_color = "#FFFFFF"
# Professional blue
h_fill = "#0054AD"
h_color = "#003366"
p_color = "#FFFFFF"
# Bold red
h_fill = "#DC3545"
h_color = "#8B0000"
p_color = "#FFFFFF"
# Nature green
h_fill = "#28A745"
h_color = "#155724"
p_color = "#FFFFFF"
# Modern purple
h_fill = "#6F42C1"
h_color = "#3D1F6B"
p_color = "#FFFFFF"
# Warm orange
h_fill = "#FD7E14"
h_color = "#A04100"
p_color = "#FFFFFF"
# Monochrome
h_fill = "#212529"
h_color = "#000000"
p_color = "#FFFFFF"
# Light theme (dark border)
h_fill = "#F8F9FA"
h_color = "#000000"
p_color = "#212529"
Ensure sufficient contrast (WCAG AA standard: 4.5:1 for normal text):
# Good contrast examples
h_fill = "#0054AD"; p_color = "#FFFFFF" # ✓ High contrast
h_fill = "#FFFFFF"; p_color = "#000000" # ✓ High contrast
# Poor contrast (avoid)
h_fill = "#FFD700"; p_color = "#FFFFFF" # ✗ Low contrast
h_fill = "#87CEEB"; p_color = "#FFFFFF" # ✗ Low contrast
library(hexSticker)
library(showtext)
library(magick)
# Load and prepare icon
icon <- image_read("man/figures/custom_icon.png")
icon <- image_transparent(icon, "white") # Make background transparent
icon <- image_trim(icon) # Remove whitespace
image_write(icon, "man/figures/icon_processed.png")
# Add font
font_add_google("Fira Sans", "firasans")
showtext_auto()
# Create sticker
sticker(
subplot = "man/figures/icon_processed.png",
s_x = 1,
s_y = 0.85,
s_width = 0.5,
s_height = 0.5,
package = "mypackage",
p_size = 22,
p_family = "firasans",
p_fontface = "bold",
p_color = "#FFFFFF",
p_y = 1.45,
h_fill = "#0054AD",
h_color = "#003366",
h_size = 1.5,
url = "mypackage.com",
u_size = 3,
u_color = "#FFFFFF",
filename = "man/figures/logo.png",
dpi = 300
)
library(hexSticker)
sticker(
subplot = ~ plot.new(),
package = "mypackage",
p_size = 24,
p_color = "#FFFFFF",
p_y = 1,
h_fill = "#0054AD",
h_color = "#000000",
spotlight = TRUE,
l_x = 1,
l_y = 0.8,
l_width = 3,
l_height = 3,
l_alpha = 0.3,
filename = "man/figures/logo.png"
)
library(hexSticker)
library(ggplot2)
library(showtext)
# Font setup
font_add_google("Roboto", "roboto")
showtext_auto()
# Create visualization
set.seed(42)
df <- data.frame(
x = rep(1:10, each = 10),
y = rep(1:10, times = 10),
z = rnorm(100)
)
p <- ggplot(df, aes(x, y, fill = z)) +
geom_tile() +
scale_fill_gradient2(
low = "#0054AD",
mid = "#FFFFFF",
high = "#DC3545",
midpoint = 0
) +
theme_void() +
theme_transparent() +
theme(legend.position = "none")
# Create sticker
sticker(
subplot = p,
s_x = 1,
s_y = 0.8,
s_width = 1.2,
s_height = 1,
package = "heatmapR",
p_size = 18,
p_family = "roboto",
p_fontface = "bold",
p_color = "#000000",
p_y = 1.55,
h_fill = "#F8F9FA",
h_color = "#000000",
h_size = 1.5,
filename = "man/figures/logo.png",
dpi = 300
)
library(hexSticker)
library(ggplot2)
library(ggraph)
library(igraph)
library(showtext)
# Font setup
font_add_google("Montserrat", "montserrat")
showtext_auto()
# Create network
set.seed(123)
g <- erdos.renyi.game(15, 0.3)
p <- ggraph(g, layout = "fr") +
geom_edge_link(color = "white", alpha = 0.5, width = 0.5) +
geom_node_point(color = "#FFA500", size = 3) +
theme_void() +
theme_transparent()
# Create sticker
sticker(
subplot = p,
s_x = 1,
s_y = 0.85,
s_width = 1.3,
s_height = 1.1,
package = "netanalysis",
p_size = 16,
p_family = "montserrat",
p_fontface = "bold",
p_color = "#FFFFFF",
p_y = 1.5,
h_fill = "#0054AD",
h_color = "#000000",
h_size = 1.5,
filename = "man/figures/logo.png",
dpi = 300
)
# mypackage <img src="man/figures/logo.png" align="right" height="139" alt="" />
<!-- badges: start -->
[](https://github.com/username/mypackage/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
Brief description of your package.
## Installation
You can install the development version of mypackage from GitHub:
```r
# install.packages("devtools")
devtools::install_github("username/mypackage")
**Height specification**: 139 pixels is standard (1/5 of typical hex height)
### Alternative: Center Logo
```markdown
<div align="center">
<img src="man/figures/logo.png" width="200" alt="mypackage logo">
<h1>mypackage</h1>
<p>Brief tagline</p>
</div>
Problem: Logo displays locally but not on GitHub
Fix:
git add man/figures/logo.pngman/figures/logo.png (not absolute)Problem: Package name is hard to read at small sizes
Fix:
p_size = 24 or higherp_fontface = "bold"Problem: Icon or plot is positioned incorrectly
Fix: Adjust position parameters:
s_x = 1 # Center horizontally (0.5-1.5 range)
s_y = 0.85 # Adjust vertical position (0.5-1.5 range)
Experiment with values to find optimal placement.
Problem: Google Fonts don't appear in output
Fix:
# Ensure showtext is loaded and enabled
library(showtext)
showtext_auto()
# Add font BEFORE creating sticker
font_add_google("Font Name", "fontid")
# Use correct font family ID
p_family = "fontid" # Not "Font Name"
Problem: SVG file has rendering problems
Fix:
Problem: PNG file is >500 KB
Fix:
# After creating logo, optimize
library(magick)
logo <- image_read("man/figures/logo.png")
logo <- image_resize(logo, "1024x") # Resize if too large
logo <- image_write(logo, "man/figures/logo.png", quality = 85)
Problem: Colors appear different on different screens
Fix:
Problem: Logo is squashed or stretched
Fix: Don't override aspect ratio - hexSticker handles this automatically. Remove any asp parameter.
Problem: URL at bottom is too small or angled
Fix:
u_size = 4 # Increase size
u_angle = 0 # Make horizontal
u_color = "#FFFFFF" # Ensure contrast
Problem: Image or plot is clipped at edges
Fix:
s_width = 0.5 # Reduce width
s_height = 0.5 # Reduce height
# Add padding in original image/plot
Create Makefile:
.PHONY: logo clean
logo:
Rscript man/figures/generate_logo.R
clean:
rm -f man/figures/logo.png man/figures/logo.svg
Usage:
make logo # Generate logo
make clean # Remove generated files
Add to .github/workflows/logo.yaml:
name: Update Logo
on:
push:
paths:
- 'man/figures/generate_logo.R'
jobs:
update-logo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
- name: Install dependencies
run: |
install.packages(c("hexSticker", "showtext", "ggplot2"))
shell: Rscript {0}
- name: Generate logo
run: Rscript man/figures/generate_logo.R
- name: Commit logo
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add man/figures/logo.png man/figures/logo.svg
git commit -m "Update logo" || echo "No changes"
git push
# Standard size (for README)
sticker(..., filename = "man/figures/logo.png", dpi = 300)
# Large size (for print)
sticker(..., filename = "man/figures/logo_large.png", dpi = 600)
# Thumbnail (for website favicon)
library(magick)
img <- image_read("man/figures/logo.png")
img_thumb <- image_resize(img, "256x256")
image_write(img_thumb, "man/figures/logo_256.png")
# Black background version
sticker(..., h_fill = "#000000", p_color = "#FFFFFF")
# White background version
sticker(..., h_fill = "#FFFFFF", p_color = "#000000", h_color = "#000000")
Creating a professional hex logo enhances your package's visibility and brand recognition!