rgbdiff | R Documentation |
A naive approach to compare two colors quantitatively. Converts colors to RGB and calculates the absolute percent differences for red, green, and blue plus the average of the three.
rgbdiff(col, col2 = NULL)
col |
a vector of colors; see |
col2 |
an optional vector of colors to compare 1:1 with |
A matrix of red, green, blue, and average overall percent differences as rows and each pair of colors as columns.
rgbdiff(1:4)
## same
rgbdiff(palette()[1:4])
## compare all combinations
rgbdiff(paste0('red', 1:4))
## only compare 1:1
rgbdiff(paste0('red', 1:4), paste0('red', 1:4))
## Not run:
## google colors from imagemagick
go <- 'https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png'
ip <- imgpal(go)
## google colors, https://www.schemecolor.com/google-logo-colors.php
go <- c('#4285F4', '#EA4335', '#FBBC05', '#34A853')
show_pal(go)
show_pal(ip, n = 4)
rgbdiff(ip$col[1:4], go)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.