cararthompson / monochromer Goto Github PK
View Code? Open in Web Editor NEWA package for creating monochrome colour palettes and easily converting rgba values to hex codes
License: Other
A package for creating monochrome colour palettes and easily converting rgba values to hex codes
License: Other
Hi Cara,
This a great package. Looking forward to learning more about it in your Workshop for Ukraine today. Just wanted to let you know that there was a small typo in the How can I use it? section.
Instead of remotes::github_install("cararthompson/monochromeR")
it should be remotes::install_github("cararthompson/monochromeR")
.
Thanks,
Kurtis
Hi!
Super cool package. I used it to extract hex codes for transparent values of a whole palette to use as different layers of a ggplot2, as the colours represent different levels of data (see below).
To do this I passed a colour palette in hex codes to hex_to_rgb() then used rgba_to_hex() with an alpha value to get the new colour palette. However hex_to_rgb() currently returns the string "r = X, g = Y, b = Z", when a vector of the three colours would be more useful maybe?
My code and function are here:
# set colours for plot
colours <- RColorBrewer::brewer.pal(10, 'Spectral')
# function to make points lighter but not transparent
alpha_hex <- function(hex_code, alpha = 1){
# split by ',' and extract number
temp <- monochromeR::hex_to_rgb(hex_code) %>%
str_split(., ',') %>%
.[[1]] %>%
parse_number
return(rgba_to_hex(c(temp, alpha)))
}
purrr::map_vec(colours, alpha_hex, alpha = 0.7)
view_palette()
currently uses scales::show_col()
to generate a visual representation of a chart, which uses plot()
to generate base R plot.
It would be convenient if view_palette()
generated a ggplot
object so that it could be passed into colorblindr::cvd_grid()
to check how a palette appears for folks with colour blindness.
e.g. penguin_colours <- c("Adelie" = "#12456", "Chinstrap" = "#fafafa")
monochromeR::view_palette(penguin_colours) - show "Adelie" and "Chinstrap" on their corresponding colours.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.