hadley wickham <h.wickham <at> gmail.com> writes: <<<pruned>>> >For example, I have this alpha function in > ggplot: > alpha <- function(colour, alpha) { > col <- col2rgb(colour, TRUE) / 255 > col[4, ] <- rep(alpha, length(colour)) > new_col <- rgb(col[1,], col[2,], col[3,], col[4,]) > new_col[is.na(colour)] <- NA > new_col > } > > which seems like a lot of work for a simple task. The fact that > col2rgb and rgb aren't symmetric is frustrating, especially since one > outputs values between 0 and 255 and the other (by default) accepts > inputs between 0 and 1. > > Package 'vcd' (and others) use package 'colorspace', > > and I have wondered in the past if these color space computations > > should not be merged into to standard R (package 'grDevices'). > > But that's really a topic for another thread, on R-devel, not R-help.. > It would definitely be nice if all colour space manipulations were > merged into a single package, with a consistent interface. I would > happily contribute to such a project, since I do a lot of colour > manipulation in ggplot. > > Hadley > It's a good thought. There is some thought going into standardizing, if you look at
http://developer.R-project.org/sRGB-RFC.html and by the way, for a previous post, it's inaccurate to call Lab "perceptual", although many people do. It's based on discrimination data in an attempt to make a uniform space for small color differences, but it is only approximately so. best, Ken PS, apologies that gmane is making me prune some quoted text ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.