-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add new article showcasing colour palette packages made with palettes
- Loading branch information
1 parent
b7a8dd0
commit fac7e4c
Showing
10 changed files
with
123 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ | |
^cran-comments\.md$ | ||
^CRAN-SUBMISSION$ | ||
^revdep$ | ||
^vignettes/articles$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
colour_names <- grDevices::colors() | ||
|
||
usethis::use_data(colour_names, overwrite = TRUE, internal = TRUE) | ||
saveRDS(colour_names, "data-raw/sysdata/colour_names.rds") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
library(dplyr) | ||
library(purrr) | ||
library(gh) | ||
library(desc) | ||
library(readr) | ||
|
||
# Please add new entries in alphabetical order, according to the package name. | ||
made_with_palettes <- tibble::tribble( | ||
~package, ~gh_owner, ~gh_repo, | ||
"hutchplot", "fhdsl", "hutchplot", | ||
"palettes", "mccarthy-m-g", "palettes", | ||
"warwickplots", "Warwick-Stats-Resources", "warwickplots" | ||
) | ||
|
||
cran_pkgs <- tools::CRAN_package_db()$Package | ||
|
||
made_with_palettes <- made_with_palettes |> | ||
rowwise() |> | ||
mutate( | ||
# Check whether package is also on CRAN | ||
on_cran = package %in% cran_pkgs, | ||
# Get and read DESCRIPTION from package GitHub repositories | ||
pkg_description = list(gh::gh( | ||
"/repos/:owner/:repo/contents/:path", | ||
owner = gh_owner, | ||
repo = gh_repo, | ||
path = "DESCRIPTION", | ||
.accept = "application/vnd.github.raw+json" | ||
)), | ||
pkg_description = purrr::pluck(pkg_description, 1), | ||
pkg_description = list(desc(text = pkg_description)), | ||
# Get and format fields from DESCRIPTION | ||
title = pkg_description$get("Title"), | ||
authors = format( | ||
pkg_description$get_author("aut"), | ||
include = c("given", "family") | ||
), | ||
# Get URLs | ||
# url = pkg_description$get_field("URL", default = NA), | ||
gh_url = paste0("https://github.com/", gh_owner, "/", gh_repo, ""), | ||
cran_url = ifelse( | ||
on_cran, paste0("https://CRAN.R-project.org/package=", package), NA | ||
) | ||
) |> | ||
select(-c(gh_owner:pkg_description)) |> | ||
arrange(package) | ||
|
||
saveRDS(made_with_palettes, "data-raw/sysdata/made-with-palettes.rds") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
colour_names <- readRDS("data-raw/sysdata/colour_names.rds") | ||
made_with_palettes<- readRDS("data-raw/sysdata/made-with-palettes.rds") | ||
|
||
usethis::use_data( | ||
colour_names, | ||
made_with_palettes, | ||
overwrite = TRUE, | ||
internal = TRUE | ||
) |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
title: "Packages made with palettes" | ||
--- | ||
|
||
<!-- TODO: Add instructions like: https://github.com/quarto-dev/quarto-web/tree/main/docs/extensions/listings --> | ||
|
||
Colour palette packages are a nice way to distribute colour palettes while getting access to all the features of **palettes** for free. Below is a listing of colour palette packages made with palettes (please [let me know]() if you have a package you’d like to see added to the list). | ||
|
||
See the vignette on creating a colour palette package to learn how to develop your own colour palette package; `vignette("creating-packages")`. | ||
|
||
```{r, echo=FALSE} | ||
library(palettes) | ||
library(gt) | ||
library(fontawesome) | ||
palettes:::made_with_palettes |> | ||
gt(id = "one") |> | ||
cols_label( | ||
package = md("**Package**"), | ||
title = md("**Description**"), | ||
authors = md("**Author**") | ||
) |> | ||
fmt_url( | ||
columns = gh_url, | ||
label = fontawesome::fa("github"), | ||
color = "#0d6efd", | ||
show_underline = FALSE | ||
) |> | ||
fmt_url( | ||
columns = cran_url, | ||
label = fontawesome::fa("r-project"), | ||
color = "#0d6efd", | ||
show_underline = FALSE | ||
) |> | ||
sub_missing() |> | ||
cols_merge( | ||
columns = c(package, gh_url, cran_url), | ||
pattern = "{2} \u2002 {3} \u2002 {1}" | ||
) |> | ||
cols_width( | ||
package ~ pct(25), | ||
title ~ pct(40), | ||
authors ~ pct(35) | ||
) |> | ||
tab_options( | ||
table.width = pct(100), | ||
table.font.size = "100%" | ||
) |> | ||
opt_css( | ||
css = " | ||
#one svg { | ||
height: 1.25rem !important; | ||
width: 1.25rem !important; | ||
} | ||
" | ||
) | ||
``` |