Skip to content

Commit

Permalink
Add new function
Browse files Browse the repository at this point in the history
  • Loading branch information
dieghernan committed Jul 11, 2024
1 parent d92126a commit 0207138
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ message: 'To cite package "rostemplate" in publications use:'
type: software
license: MIT
title: 'rostemplate: Plantilla ''pkgdown'' para los paquetes de ''rOpenSpain'''
version: 0.2.0
version: 0.2.0.9000
abstract: Plantilla privada para uso exclusivo de los paquetes de rOpenSpain.
authors:
- family-names: Hernangómez
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: rostemplate
Title: Plantilla 'pkgdown' para los paquetes de 'rOpenSpain'
Version: 0.2.0
Version: 0.2.0.9000
Authors@R:
person("Diego", "Hernangómez", , "diego.hernangomezherrero@gmail.com", role = c("aut", "cre", "cph"),
comment = c(ORCID = "0000-0001-8457-4658", affiliation = "rOpenSpain"))
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export(ros_badge_ropenspain)
export(ros_build)
export(ros_gradient_pal)
export(ros_green_pal)
export(ros_metro_madrid_pal)
export(ros_qualitative_pal)
export(ros_violet_pal)
importFrom(grDevices,adjustcolor)
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# rostemplate (development version)

- Añade una nueva paleta de colores `ros_metro_madrid_pal()`.

# rostemplate 0.2.0

**Importante!** Configuración mínima en `pkgdowm.yaml` ha de ser:
Expand Down
32 changes: 32 additions & 0 deletions R/ros_pals.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#' scales::show_col(ros_gradient_pal(9))
#'
#' scales::show_col(ros_qualitative_pal(9))
#'
#' scales::show_col(ros_metro_madrid_pal(9))
ros_green_pal <- function(n = 4, alpha = 0.9, rev = FALSE) {
cols <- c("#98c00b", "#e0ecb5")
if (rev) {
Expand Down Expand Up @@ -106,3 +108,33 @@ ros_qualitative_pal <- function(n = 6, alpha = 0.9, rev = FALSE) {

return(colors)
}

#' @rdname ros_pals
#'
#' @export
ros_metro_madrid_pal <- function(n = 4, alpha = 0.9, rev = FALSE) {
cols <- c(
"#39b5e6", "#e0292f", "#ffe114", "#b6551a", "#96bf0d", "#9a9999",
"#ff7c00", "#f373b7", "#990d66", "#1b0c80", "#136926", "#999933"
)

if (n > length(cols)) {
warning(
"ros_metropal_color() has ", length(cols),
", less than requested (", n, ")"
)
n <- length(cols)
}

colors <- cols[seq_len(n)]

if (rev) colors <- rev(colors)

if (alpha == 1) {
return(colors)
}

colors <- adjustcolor(colors, alpha.f = alpha)

return(colors)
}
6 changes: 3 additions & 3 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
"codeRepository": "https://github.com/ropenspain/rostemplate",
"issueTracker": "https://github.com/ropenspain/rostemplate/issues",
"license": "https://spdx.org/licenses/MIT",
"version": "0.2.0",
"version": "0.2.0.9000",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.4.1 (2024-06-14 ucrt)",
"runtimePlatform": "R version 4.4.1 (2024-06-14)",
"author": [
{
"@type": "Person",
Expand Down Expand Up @@ -146,7 +146,7 @@
"SystemRequirements": null
},
"isPartOf": "https://ropenspain.es/",
"fileSize": "221.292KB",
"fileSize": "220.166KB",
"citation": [
{
"@type": "SoftwareSourceCode",
Expand Down
4 changes: 2 additions & 2 deletions inst/schemaorg.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.4.1 (2024-06-14 ucrt)",
"version": "0.2.0"
"runtimePlatform": "R version 4.4.1 (2024-06-14)",
"version": "0.2.0.9000"
},
{
"type": "SoftwareSourceCode",
Expand Down
5 changes: 5 additions & 0 deletions man/ros_pals.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified vignettes/plot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0207138

Please sign in to comment.