# [GRASSLIST:2292] Re: r.patch -- problem solved

Michel Wurtz mw at teledetection.fr
Tue Aug 7 05:35:17 EDT 2001

```Rich Shepard wrote:
>
>   I'll have to read r.colors again until I fully understand this. Looking at
> one of the files in colr/, I see this:
>
> [rshepard at salmo colr]\$ less temp_dem
> % 1200 2721.300048828125
> 1200:255:85:85 1453.550008138:170:170:0
> 1453.550008138:170:170:0 1707.100016276:85:255:85
> 1707.100016276:85:255:85 1960.6500244141:0:170:170
> 1960.6500244141:0:170:170 2214.2000325521:85:85:255
> 2214.2000325521:85:85:255 2467.7500406901:170:0:170
> 2467.7500406901:170:0:170 2721.300048828125:255:85:85
>
>   It looks to me that there are 12 colors and each is assigned to a range of
> values, the lower bound of which is specified? The range of elevation values
> here (I believe in meters) is on the first line. FWIW, I had nlev=256 set
> for this display.
>

In fact, there is 6 "color ramps" defined here. You can also see that the
second element of each line is the same that the first element of next line.
You are right that the first line gives the range of the values in the
raster file.
Each subsequent line gives a lower bound and an upper bound, and for
each one a color (R,G,B, each of them from 0 to 255). The color for the
values between the lower and upper bound are lineary interpolated for red,
green and blue.

Ex:  if you have 100:200:0:0 200:0:200:0

value 100 : color = (red=200,green=0,blue=0)
value 101 : color = (198,2,0)
....
value 150 : color = (150,150,0)
...
value 199 : color = (2,198,0)
value 200 : color = (0,200,0)

with this knowledge, you can edit yourself some colr/ file for your own
purpose...
--
Michel WURTZ - DIG - Maison de la télédétection
500, rue J.F. Breton
34093 MONTPELLIER Cedex 5

```