colors_rgb = matrix(c(255, 0, 0, 100, 100, 100, 10, 10, 10, 5, 5, 5),
ncol = 3, byrow = TRUE);
fixed_palette_rgb = matrix(c(255, 0, 0, 255, 5, 0, 11, 11, 11, 0, 0, 0,
255, 255, 255), ncol = 3, byrow = TRUE);
pal_similar_colors = closest.color.from.palette(colors_rgb,
fixed_palette_rgb);
Run the code above in your browser using DataLab