R/rgb2.R

setClass("RGBStrictHash", contains = "RGB")

setAs("character", "RGBStrictHash",
      function(from) {
         if(substring(from, 1, 1) == "0x") {
           ans = new("RGBStrictHash", toRGBHexInt(from, "#"))
         } else {
           v = col2rgb(from)
           new("RGBStrictHash", toRGBHexInt(rgb(v[1], v[2], v[3], maxColorValue = 255), "#"))
         }
      })
duncantl/R2GoogleMaps documentation built on May 15, 2019, 5:26 p.m.