You can get hexadecimal code for terrain.colors by typing the following in R:
> terrain.colors(6)
> t(col2rgb(terrain.colors(6)))
red green blue
[1,] 0 166 0
[2,] 99 198 0
[3,] 230 230 0
[4,] 234 182 78
[5,] 238 185 159
[6,] 242 242 242
You can pick the color from different sources, even from nature or based on your own choice !
Formula:
For R column and row 2:
=HEX2DEC(LEFT(A2,2))
For G column and row 2:
=HEX2DEC(MID(A2, 3,2))
For B column and row 2:
=HEX2DEC(MID(A2, 5,2))
You can add color one by one, up to 6.
Plot in R:
barplot(seq(1:6), col=terrain.colors(6))
More color to practice:
> heat.colors(6)
[1] "#FF0000FF" "#FF4000FF" "#FF8000FF" "#FFBF00FF" "#FFFF00FF" "#FFFF80FF"
> t(col2rgb(heat.colors(6)))
red green blue
[1,] 255 0 0
[2,] 255 64 0
[3,] 255 128 0
[4,] 255 191 0
[5,] 255 255 0
[6,] 255 255 128
> t(col2rgb(topo.colors(6)))
red green blue
[1,] 76 0 255
[2,] 0 229 255
[3,] 0 255 77
[4,] 230 255 0
[5,] 255 255 0
[6,] 255 224 179
> t(col2rgb(cm.colors(6)))
red green blue
[1,] 128 255 255
[2,] 170 255 255
[3,] 213 255 255
[4,] 255 213 255
[5,] 255 170 255
[6,] 255 128 255
> t(col2rgb(rainbow(6)))
red green blue
[1,] 255 0 0
[2,] 255 255 0
[3,] 0 255 0
[4,] 0 255 255
[5,] 0 0 255
[6,] 255 0 255
More list of favorate colors:
R | G | B | |||
aquamarine4 | #458B74 | 69 | 139 | 116 | |
darkolivegreen | #556B2F | 85 | 107 | 47 | |
darkolivegreen4 | #6E8B3D | 110 | 139 | 61 | |
darkgreen | #006400 | 0 | 100 | 0 | |
darkorchid4 | #68228B | 104 | 34 | 139 | |
cadetblue | #5F9EA0 | 95 | 158 | 160 | |
cadetblue4 | #53868B | 83 | 134 | 139 | |
burlywood4 | #8B7355 | 139 | 115 | 85 | |
chartreuse4 | #458B00 | 69 | 139 | 0 | |
aliceblue | #F0F8FF | 240 | 248 | 255 | |
deepskyblue4 | #00688B | 0 | 104 | 139 | |
forestgreen | #228B22 | 34 | 139 | 34 | |
khaki4 | #8B864E | 139 | 134 | 78 | |
lightcoral | #F08080 | 240 | 128 | 128 | |
mediumaquamarine | #66CDAA | 102 | 205 | 170 | |
lightgreen | #90EE90 | 144 | 238 | 144 | |
mediumorchid4 | #7A378B | 122 | 55 | 139 | |
midnightblue | #191970 | 25 | 25 | 112 | |
lightseagreen | #20B2AA | 32 | 178 | 170 | |
lightsalmon4 | #8B5742 | 139 | 87 | 66 | |
steelblue4 | #36648B | 54 | 100 | 139 | |
tan4 | #8B5A2B | 139 | 90 | 43 | |
yellowgreen | #9ACD32 | 154 | 205 | 50 | |
slategrey | #708090 | 112 | 128 | 144 |
Due to presence of # and 6 digit code, the formula for R, G, B calculated is slightly modified.
For R:
=HEX2DEC(MID(C2,2,2))
For G:
=HEX2DEC(MID(C2, 4,2))
For R:
=HEX2DEC(MID(C2, 6,2))
No comments:
Post a Comment