colorspace: Color Space Manipulation
色空間操作
> library(colorspace)
バージョン: 1.2.6
| 関数名 | 概略 | 
|---|---|
| HLS | Create HLS Colors | 
| HSV | Create HSV Colors | 
| LAB | Create LAB Colors | 
| LUV | Create LUV Colors | 
| RGB | Create RGB Colors | 
| USSouthPolygon | Polygon for County Map of US South States: Alabama, Georgia, and South Carolina | 
| XYZ | Create XYZ Colors | 
| choose_palette | Graphical User Interface for Choosing HCL Color Palettes | 
| color-class | Class "color" | 
| coords | Extract the numerical coordinates of a color | 
| desaturate | Desaturate Colors by Chroma Removal in HCL Space | 
| hex | Convert Colors To Hexadecimal Strings | 
| hex2RGB | Convert Hexadecimal Color Specifications To RGB Objects | 
| mixcolor | Compute the convex combination of two colors | 
| polarLAB | Create polarLAB Colors | 
| polarLUV | Create polarLUV Colors | 
| rainbow_hcl | HCL and HSV Color Palettes | 
| readRGB | Read RGB Color Descriptions | 
| readhex | Read Hexadecimal Color Descriptions | 
| sRGB | Create sRGB Colors | 
| writehex | Write Hexadecimal Color Descriptions | 
HLS
HLSカラーの生成
CSS3では16進数で表現するRGBよりも直感的な数値を指定できるHSLカラー http://howtohp.com/2012/02/02/hsl-color/
> HLS(H, L, S, names)
HSV
HSVカラーの生成
> HSV(H, S, V, names)
RGB
> RGB(R, G, B, names)
choose_palette
インタラクティブにHCLカラーパレットを選択する
> choose_palette
hex
色空間を16進数表記に変換
> HSV(seq(0, 360, length = 7)[-7], 1, 1) %>% hex(.)
[1] "#FF0000" "#FFFF00" "#00FF00" "#00FFFF" "#0000FF" "#FF00FF"
hex2RGB
16進数表記の色空間をRGB値に変換
> hex2RGB(c("#FF0000", "#00FF00", "#0000FF"))
     R G B
[1,] 1 0 0
[2,] 0 1 0
[3,] 0 0 1