Skip to content

Instantly share code, notes, and snippets.

@gka
Created January 24, 2013 13:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gka/4621398 to your computer and use it in GitHub Desktop.
Save gka/4621398 to your computer and use it in GitHub Desktop.
Playing around with CIE Lab colors in R
#
# Playing around with CIE Lab colors in R
#
# load library that provides colorRampPalette
library(grDevices)
# define function for plotting colors
plotColors = function(palette, n=10) {
colors = palette(n)
barplot(rep(1,n), col=colors, border=colors, space=0, yaxt='n')
}
# take a look at rgb interpolation
pal = colorRampPalette(c("#FF0000", "#0000FF"))
plotColors(pal, 5)
# and compare it with Lab
pal = colorRampPalette(c("#FF0000", "#0000FF"), space="Lab")
plotColors(pal, 5)
@isomorphisms
Copy link

Thanks!

@bjtree
Copy link

bjtree commented Oct 31, 2016

This was great thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment