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
5 changes: 4 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# gitdevr 0.0.0.9000

- Code blocks now use the GitHub palette in light mode and One Dark in dark mode, matching the Chulapa highlighters.
- Code blocks now use the GitHub palette in light mode and One Dark in dark mode, with small adjustments to comments and One Dark names for accessible contrast.
- Navigation hover and focus states have improved contrast, and linked code tokens retain their underline.
- Mobile code blocks scroll within their containers.
- Page transitions and callout icon animations respect reduced motion preferences.
- The package is in active development.
- `test()` now returns `NULL` invisibly, as documented.
20 changes: 18 additions & 2 deletions data-raw/compress_css.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
# Compress CSS with `sass`.
library(sass)

lns <- readLines("inst/pkgdown/assets/BS5/gitdevr.css")
source_path <- "inst/pkgdown/assets/BS5/gitdevr.css"
lns <- paste(readLines(source_path), collapse = "\n")
palette <- yaml::read_yaml("inst/brand_yml/_brand.yml")$color$palette
names(palette) <- gsub("-", "_", names(palette), fixed = TRUE)

# writeLines(lns, "inst/pkgdown/assets/BS5/gitdevr.min.css")
# Keep Bootstrap's RGB utilities in sync with the same brand colors.
pattern <- "--bs-[a-z0-9-]+: var\\(--brand-[a-z0-9_]+\\);"
declarations <- regmatches(lns, gregexpr(pattern, lns))[[1]]
for (declaration in declarations) {
property <- sub(":.*", "", declaration)
color <- sub(".*--brand-([a-z0-9_]+)\\);", "\\1", declaration)
channels <- paste(grDevices::col2rgb(palette[[color]])[, 1], collapse = ", ")
lns <- gsub(
paste0(property, "-rgb: [^;]+;"),
paste0(property, "-rgb: ", channels, ";"),
lns
)
}
writeLines(lns, source_path)

sass(
lns,
Expand Down
1 change: 1 addition & 0 deletions inst/brand_yml/_brand.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ color:
footer-text: "#8b949e"
footer-link: "#58a6ff"
dk-dark: "#343a40"
dk-body: "#24292f"
dk-black: "#373e47"
dk-border: "#6a788a"
dk-gray: "#a8b3c1"
Expand Down
1 change: 1 addition & 0 deletions inst/pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ template:
footer-text: "#8b949e"
footer-link: "#58a6ff"
dk-dark: "#343a40"
dk-body: "#24292f"
dk-black: "#373e47"
dk-border: "#6a788a"
dk-gray: "#a8b3c1"
Expand Down
Loading
Loading