Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ knitr::opts_chunk$set(
)
```

# positively
# positively <a href="https://r-causal.github.io/positively/"><img src="man/figures/logo.png" align="right" height="138" alt="positively website" /></a>

<!-- badges: start -->
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->

# positively
# positively <a href="https://r-causal.github.io/positively/"><img src="man/figures/logo.png" align="right" height="138" alt="positively website" /></a>

<!-- badges: start -->

Expand Down
1 change: 1 addition & 0 deletions data-raw/logo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exports/
13 changes: 13 additions & 0 deletions data-raw/logo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Package logo

The text-free artwork was generated with the built-in image-generation tool.
`prompt.txt` records the artwork prompt. `sticker.svg` adds editable typography
and a border clipped to the 1.74 by 2 inch hexagon.

Run `Rscript data-raw/logo/build.R` from the package root to export a 600 dpi
print PNG and an SVG with outlined text to `exports/`, then install the README
logo with `usethis::use_logo()`.

The build requires the R packages base64enc, magick, rsvg, systemfonts, and
usethis, plus Gill Sans installed locally.
The artwork, fonts, and print tools are not package runtime dependencies.
Binary file added data-raw/logo/artwork.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions data-raw/logo/build.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Run from the package root: Rscript data-raw/logo/build.R
args <- commandArgs(trailingOnly = FALSE)
script <- sub("^--file=", "", args[grepl("^--file=", args)])
source_dir <- dirname(normalizePath(script))
root <- normalizePath(file.path(source_dir, "../.."))
svg <- paste(readLines(file.path(source_dir, "sticker.svg")), collapse = "\n")
families <- regmatches(svg, gregexpr('font-family="[^"]+"', svg))[[1]]
families <- unique(sub('font-family="([^"]+)"', "\\1", families))
missing <- setdiff(families, systemfonts::system_fonts()$family)
if (length(missing)) {
stop(
"Install the source fonts before rebuilding: ",
paste(missing, collapse = ", ")
)
}
art <- base64enc::dataURI(
file = file.path(source_dir, "artwork.png"),
mime = "image/png"
)
svg <- sub("artwork.png", art, svg, fixed = TRUE)
exports <- file.path(source_dir, "exports")
dir.create(exports, showWarnings = FALSE)
print_png <- file.path(exports, "logo.png")
raster <- rsvg::rsvg_png(charToRaw(svg), width = 1044, height = 1200)
magick::image_write(
magick::image_read(raster),
path = print_png,
format = "png",
density = "600x600"
)

# Outline the text separately to avoid resampling the embedded artwork.
text_only <- gsub("<image[^>]*/>", "", svg)
text_only <- gsub("<rect[^>]*/>", "", text_only)
text_only <- gsub('<polygon id="sticker-border"[^>]*/>', "", text_only)
print_svg <- file.path(exports, "logo.svg")
rsvg::rsvg_svg(charToRaw(text_only), print_svg, width = 1740, height = 2000)
outlined <- paste(readLines(print_svg), collapse = "\n")
inner <- sub("(?s).*?<svg[^>]*>", "", outlined, perl = TRUE)
inner <- sub("</svg>\\s*$", "", inner, perl = TRUE)
without_text <- gsub("(?s)<text[^>]*>.*?</text>", "", svg, perl = TRUE)
combined <- sub("</svg>", paste0(inner, "</svg>"), without_text, fixed = TRUE)
stopifnot(!grepl("<text[ >]", combined))
writeLines(combined, print_svg)

usethis::proj_set(root)
options(usethis.overwrite = TRUE)
usethis::use_logo(print_png)
1 change: 1 addition & 0 deletions data-raw/logo/prompt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use case: precise-object-edit. Simplify ONLY the surrounding foliage of the supplied happy flower illustration. Preserve the smiling cream face and ALL flower petals exactly, including gold tips blending through green into rich teal toward the center, pale vein lines, coral cheeks, and distressed print texture. Preserve the flower's size and placement. Reduce surrounding foliage by about HALF: remove the tall side sprigs, the little coral berry clusters and tiny extra flowers. Keep just the two broad crossed leaves immediately below the main flower, one teal and one ochre with their green overlap, plus at most one small short supporting leaf on each side. Leave generous warm cream negative space around the flower. The result is the SAME happy blended-color bloom, with a much simpler base of leaves, no wreath or tall side branches. Fill removed regions with the same opaque warm cream #f5ecd8 background; no black or transparent background. Keep original portrait 3:4 canvas and spacious lower quarter blank for separate real typography. No text, letters, numbers, borders, hexagons or added objects.
6 changes: 6 additions & 0 deletions data-raw/logo/sticker.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 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.
Binary file added pkgdown/favicon/apple-touch-icon.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 added pkgdown/favicon/favicon-96x96.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 added pkgdown/favicon/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions pkgdown/favicon/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions pkgdown/favicon/site.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "",
"short_name": "",
"icons": [
{
"src": "/web-app-manifest-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
},
{
"src": "/web-app-manifest-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
Binary file added pkgdown/favicon/web-app-manifest-192x192.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 added pkgdown/favicon/web-app-manifest-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading