rgbToKMLColor: Convert an R color to KML color

Description Usage Arguments Value Note Examples

Description

This function attempts to be very flexible in taking a color specified for R and converting it to the format that KML uses to represent a color, namely ALPHA GREEN BLUE RED!

This is exported so that others building on the RKML package can use it directly without requiring calls of the form RKML:::rgbToKMLColor (which are slow!).

Usage

1

Arguments

x

the color to convert to KML form. This can be a named color such as "red" or "pink", or in RGB or RGBA format such as "#FF0000" or "#FF0000888", or a vector/matrix of one column of numbers giving the RGB components, i.e. returned from col2rgb. This is a single value, not a vector.

Value

A character vector.

Note

This is not vectorized at present.

Examples

1
2
3
4
5
6
 rgbToKMLColor("red")
 rgbToKMLColor("#FF0000")
 rgbToKMLColor("#FF000099")
 rgbToKMLColor("#FF000099")

 rgbToKMLColor(col2rgb("red")) # Also starts a graphics device.

duncantl/RKML documentation built on May 15, 2019, 5:31 p.m.