| Type: | Package |
| Title: | A Set of Color Palettes Inspired by OK Go Music Videos for 'ggplot2' in R |
| Version: | 0.1.0 |
| Description: | A collection of aesthetically appealing color palettes for effective data visualization with 'ggplot2'. Palettes support both discrete and continuous data. |
| License: | GPL-3 |
| Encoding: | UTF-8 |
| Imports: | ggplot2 (≥ 3.0.0) |
| Suggests: | testthat (≥ 3.0.0), knitr, rmarkdown |
| URL: | https://github.com/nelsonquesado/okcolors |
| BugReports: | https://github.com/nelsonquesado/okcolors/issues |
| Depends: | R (≥ 3.5.0) |
| RoxygenNote: | 7.3.2 |
| NeedsCompilation: | no |
| Packaged: | 2025-05-12 11:36:11 UTC; nelsonquesado |
| Author: | Nelson de O. Quesado Filho [aut, cre], Ana Flávia Teles Silveira [aut] |
| Maintainer: | Nelson de O. Quesado Filho <nquesado@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2025-05-14 08:10:02 UTC |
Retrieve a Color Palette from the okcolors package
Description
Returns a vector of 'n' colors from a specified palette included in the okcolors package.
Usage
okcolors(palette = "obsession", n = 5)
Arguments
palette |
Character. Name of the palette to use. One of '"it"', '"stone"', '"skyscrapers"', '"obsession"', or '"moment"'. Default is '"obsession"'. |
n |
Integer. Number of colors to return. Default is '5'. |
Details
The available palettes are:
-
"it"– dark reds to light pinks:"#330000"(dark maroon),"#660000"(deep red),"#cc0033"(vivid red),"#ff6699"(pink coral),"#ffcc99"(peach). -
"stone"– earthy tones with pastels:"#bc8553"(bronze),"#dea466"(sand),"#ff99cc"(bubblegum pink),"#ffccff"(lavender blush),"#c3dda2"(sage). -
"skyscrapers"– vibrant contrasting urban tones:"#ff3366"(raspberry),"#ff6633"(orange coral),"#ffcc66"(light gold),"#33cccc"(turquoise),"#663366"(plum). -
"obsession"– bold and vivid colors for attention-grabbing visuals:"#45924c"(forest green),"#e96cd2"(orchid),"#4561cf"(royal blue),"#f44f49"(tomato red),"#f0cc36"(sunflower). -
"moment"– saturated and modern hues:"#ffccff"(lavender blush),"#e96cd2"(orchid),"#ff3366"(raspberry),"#33cccc"(turquoise),"#f99841"(orange sherbet).
Value
A character vector of hex color codes of length 'n'.
Examples
okcolors("stone", 3)
okcolors("obsession", 7)
Custom ggplot2 Color Scale using okcolors Palettes
Description
Applies a custom discrete or continuous color scale to ggplot2 plots using a selected palette from the okcolors package.
Usage
scale_color_okcolors(palette = "obsession", discrete = TRUE, ...)
Arguments
palette |
Character. Name of the palette to use. Must be one of the palettes available in 'okcolors()'. Default is '"obsession"'. |
discrete |
Logical. Whether to use a discrete scale ('TRUE') or a continuous scale ('FALSE'). Default is 'TRUE'. |
... |
Additional arguments passed to 'ggplot2::discrete_scale()' or 'ggplot2::scale_color_gradientn()'. |
Value
A 'Scale' object that can be added to a ggplot2 plot.
Examples
library(ggplot2)
ggplot2::ggplot(ggplot2::mpg, ggplot2::aes(displ, hwy, color = class)) +
ggplot2::geom_point(size = 3) +
scale_color_okcolors("obsession")
ggplot2::ggplot(ggplot2::mpg, ggplot2::aes(displ, hwy, color = hwy)) +
ggplot2::geom_point(size = 3) +
scale_color_okcolors("skyscrapers", discrete = FALSE)
Custom ggplot2 Fill Scale using okcolors Palettes
Description
Applies a custom discrete or continuous fill scale to ggplot2 plots using a selected palette from the okcolors package.
Usage
scale_fill_okcolors(palette = "obsession", discrete = TRUE, ...)
Arguments
palette |
Character. Name of the palette to use. Must be one of the palettes available in 'okcolors()'. Default is '"obsession"'. |
discrete |
Logical. Whether to use a discrete scale ('TRUE') or a continuous scale ('FALSE'). Default is 'TRUE'. |
... |
Additional arguments passed to 'ggplot2::discrete_scale()' or 'ggplot2::scale_fill_gradientn()'. |
Value
A 'Scale' object that can be added to a ggplot2 plot.
Examples
ggplot2::ggplot(ggplot2::mpg, ggplot2::aes(class, fill = class)) +
ggplot2::geom_bar() +
scale_fill_okcolors("skyscrapers")
ggplot2::ggplot(ggplot2::mpg, ggplot2::aes(displ, hwy, fill = hwy)) +
ggplot2::geom_tile() +
scale_fill_okcolors("obsession", discrete = FALSE)