Skip to content

Commit

Permalink
scales methods v0
Browse files Browse the repository at this point in the history
  • Loading branch information
pvictor committed Aug 28, 2018
1 parent 1c89c1c commit 6d17c67
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions R/chroma-class.R
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,30 @@ chroma <- R6::R6Class(
return(res)
},

# Scales
scale = function(colors) {
not_initialized(private$initialized)
private$chroma$scale <- glue::glue(
"scale([{colors}])",
colors = stri_c(glue::single_quote(colors), collapse = ", ")
)
},
mode = function(mode = c("rgb", "lab", "lrgb", "hsl", "lch")) {
mode <- match.arg(mode)
private$chroma$mode <- glue::glue("mode('{mode}')")
},
correctLightness = function() {
private$chroma$correctLightness <- "correctLightness()"
},
colors = function(n) {
if (length(n) == 1) {
private$chroma$colors <- glue::glue("colors({n})")
} else {
private$chroma$colors <- glue::glue("([{n}])", n = stri_c(n, collapse = ", "))
}
},


# R methods
print = function() {
code <- private$chroma
Expand Down

0 comments on commit 6d17c67

Please sign in to comment.