v.colors(1grass)

✨ v.colors ✨

okay bestie, welcome to v.colors, from the GRASS User's Manual πŸ’– it's v.colors(1grass), and it's about to make your vector maps absolutely gorgeous 🌈


πŸ‘‘ NAME πŸ‘‘

v.colors β€” creates/modifies the color table associated with a vector map πŸ’…

🏷️ KEYWORDS 🏷️

vector, color table

πŸ¦‹ SYNOPSIS πŸ¦‹

v.colors
v.colors --help
v.colors [-rwldngac] map=name  [layer=string]  use=string  [column=name]
[range=min,max]   [color=style]   [raster=name]   [raster_3d=name]
[rules=name]   [rgb_column=name]   [--help]  [--verbose]  [--quiet]
[--ui]

🚩 Flags 🚩

  • -r β€” Remove existing color table πŸ—‘οΈ
  • -w β€” Only write new color table if it does not already exist (she's shy, she won't touch what's already there πŸ’œ)
  • -l β€” List available rules then exit πŸ“‹
  • -d β€” List available rules with description then exit. If a color rule is given, only this rule is listed πŸ‘€
  • -n β€” Invert colors πŸ”„
  • -g β€” Logarithmic scaling πŸ“ˆ
  • -a β€” Logarithmic-absolute scaling πŸ“‰
  • -c β€” Convert color rules from RGB values to color table. Option rgb_column with valid RGB values required ⚠️
  • --help β€” Print usage summary πŸ†˜
  • --verbose β€” Verbose module output πŸ—£οΈ
  • --quiet β€” Quiet module output 🀫
  • --ui β€” Force launching GUI dialog πŸ–₯️

πŸŽ€ Parameters πŸŽ€

  • map=name [required] β€” Name of vector map. Or data source for direct OGR access πŸ“
  • layer=string β€” Layer number or name. Vector features can have category values in different layers. This number determines which layer to use. When used with direct OGR access this is the layer name. Default: 1 πŸ§…
  • use=string [required] β€” Source values.
    • Options: attr, cat, z
    • Default: cat
    • attr: read values from attribute table (requires <column> option) πŸ“Š
    • cat: use category values πŸ”’
    • z: use z coordinate (3D points or centroids only) πŸ”οΈ
  • column=name β€” Name of column containing numeric data. Required for use=attr πŸ“
  • range=min,max β€” Manually set range (refers to column option). Ignored when rules given 🚫
  • color=style β€” Name of color table 🎨

Options: aspect, aspectcolr, bcyr, bgyr, blues, byg, byr, celsius, corine, curvature, differences, elevation, etopo2, evi, fahrenheit, forest_cover, gdd, grass, greens, grey, grey.eq, grey.log, grey1.0, grey255, gyr, haxby, inferno, kelvin, magma, ndvi, ndwi, nlcd, oranges, plasma, population, population_dens, precipitation, precipitation_daily, precipitation_monthly, rainbow, ramp, random, reds, roygbiv, rstcurv, ryb, ryg, sepia, slope, soilmoisture, srtm, srtm_percent, srtm_plus, terrain, viridis, water, wave

  • aspect: aspect oriented grey colors [range: map values] 🌫️
  • aspectcolr: aspect oriented rainbow colors [range: 0 to 360] 🌈
  • bcyr: blue through cyan through yellow to red [range: map values] πŸ’™
  • bgyr: blue through green through yellow to red [range: map values] πŸ’š
  • blues: white to blue [range: map values] 🀍
  • byg: blue through yellow to green [range: map values] πŸ’›
  • byr: blue through yellow to red [range: map values] ❀️
  • celsius: blue to red for degree Celsius temperature [range: -80 to 80] 🌑️
  • corine: EU Corine land cover colors [range: 111 to 995] πŸ—ΊοΈ
  • curvature: for terrain curvatures (from v.surf.rst and r.slope.aspect) [range: map values] ⛰️
  • differences: differences oriented colors [range: map values] ↔️
  • elevation: maps relative ranges of raster values to elevation color ramp [range: map values] πŸ”οΈ
  • etopo2: colors for ETOPO2 worldwide bathymetry/topography [range: -11000 to 8850] 🌊
  • evi: enhanced vegetative index colors [range: -1 to 1] 🌿
  • fahrenheit: blue to red for Fahrenheit temperature [range: -112 to 176] πŸ”₯
  • forest_cover: percentage of forest cover [range: 0 to 100] 🌲
  • gdd: accumulated growing degree days [range: 0 to 6000] 🌱
  • grass: GRASS green (perceptually uniform) [range: map values] πŸ’š
  • greens: white to green [range: map values] πŸƒ
  • grey: grey scale [range: map values] 🩢
  • grey.eq: histogram-equalized grey scale [range: map values] πŸ“Š
  • grey.log: histogram logarithmic transformed grey scale [range: map values] πŸ“ˆ
  • grey1.0: grey scale for raster values between 0.0-1.0 [range: 0 to 1] πŸŒ‘
  • grey255: grey scale for raster values between 0-255 [range: 0 to 255] πŸŒ•
  • gyr: green through yellow to red [range: map values] πŸ’š
  • haxby: relative colors for bathymetry or topography [range: map values] 🏞️
  • inferno: perceptually uniform sequential color table inferno [range: map values] πŸ”₯
  • kelvin: blue to red for temperature in Kelvin scale [range: 193.15 to 353.15] ❄️
  • magma: perceptually uniform sequential color table magma [range: map values] πŸŒ‹
  • ndvi: Normalized Difference Vegetation Index colors [range: -1 to 1] 🌾
  • ndwi: Normalized Difference Water Index colors [range: -200 to 200] πŸ’§
  • nlcd: US National Land Cover Dataset colors [range: 0 to 95] πŸ‡ΊπŸ‡Έ
  • oranges: white to orange [range: map values] 🍊
  • plasma: perceptually uniform sequential color table plasma [range: map values] πŸ’œ
  • population: color table covering human population classification breaks [range: 0 to 2e+09] πŸ‘₯
  • population_dens: color table covering human population density classification breaks [range: 0 to 1e+09] πŸ™οΈ
  • precipitation: precipitation color table (0..2000mm) [range: 0 to 7000] 🌧️
  • precipitation_daily: precipitation color table (0..1000mm) [range: 0 to 10000] β˜”
  • precipitation_monthly: precipitation color table (0..1000mm) [range: 0 to 1000] 🌦️
  • rainbow: rainbow color table [range: map values] 🌈
  • ramp: color ramp [range: map values] πŸ“
  • random: random color table [range: map values] 🎲
  • reds: white to red [range: map values] 🌹
  • roygbiv: [range: map values] 🎨
  • rstcurv: terrain curvature (from r.resamp.rst) [range: map values] πŸͺ¨
  • ryb: red through yellow to blue [range: map values] πŸ”΄
  • ryg: red through yellow to green [range: map values] 🟒
  • sepia: yellowish-brown through to white [range: map values] πŸ“œ
  • slope: r.slope.aspect-type slope colors for raster values 0-90 [range: 0 to 90] ⛰️
  • soilmoisture: soilmoisture color table (0.0-1.0) [range: 0 to 1] πŸ’¦
  • srtm: color palette for Shuttle Radar Topography Mission elevation [range: -11000 to 8850] πŸ›°οΈ
  • srtm_percent: color palette for Shuttle Radar Topography Mission using relative elevation [range: map values] πŸ“‘
  • srtm_plus: color palette for Shuttle Radar Topography Mission elevation (with seafloor colors) [range: -11000 to 8850] 🌊
  • terrain: global elevation color table covering -11000 to +8850m [range: -11000 to 8850] πŸ—»
  • viridis: perceptually uniform sequential color table viridis [range: map values] πŸ’š
  • water: water depth [range: map values] 🌊
  • wave: color wave [range: map values] 〰️
  • raster=name β€” Raster map from which to copy color table πŸ“₯
  • raster_3d=name β€” 3D raster map from which to copy color table πŸ“₯
  • rules=name β€” Path to rules file πŸ“„
  • rgb_column=name β€” Name of color column to populate RGB values. If not given writes color table 🎯

πŸ’– DESCRIPTION πŸ’–

okay so v.colors lets you create or modify the color table associated with a vector map, and it's basically the vector-map twin of r.colors for raster maps 🫢

Color rules are built from features category values (use=cat) or numeric data column (use=attr) defined by column option. For 3D vector maps is allowed to define color rules based on points or centroids z-coordinate (use=z). 3D vector lines are not supported ⚠️ (not me with the 3D lines, they said no πŸ’€).

The raster option allows user to specify a raster map from which to copy the color table, similarly raster_3d option for 3D raster map. Without use=attr and column options, raster values will be matched with categories. Use these two options to transfer raster colors to vector attributes ✨.

The rules color table type will cause v.colors to read color table specifications from given file and will build the color table accordingly. See r.colors manual page for details πŸ“–.

If the user specifies the -w flag, the current color table file for the input map will not be overwritten. This means that the color table is created only if the vector map does not already have a color table. If this option is not specified, the color table will be created if one does not exist, or modified if it does πŸ‘‘.

Alternatively the color rules can be stored in a string column (rgb_column) by saving the RRR:GGG:BBB values suitable for use with d.vect πŸŽ€.

πŸ“ NOTES πŸ“

For vector maps with a large number of features it's more convenient to store color rules in an attribute column (given by rgb_column) rather then in a color table file. Reading color tables with more then 1000 items is slow 🐌

ngl bestie, if you've got a gazillion features, put those rules in the attribute column, not the color table file. she's slow past 1000 items, fr fr πŸ’€

✨ EXAMPLES ✨

Okay bestie, this is the part where it gets fun. Real commands, real maps, real slay πŸ’…


🌈 Define color table based on categories

Wanna paint your vector map by category? Say less.

So you're defining a color table called wave based on the categories from layer 1:

v.colors map=soils_general layer=1 color=wave

πŸ“Š Define color table based on attribute values

Now we're doing it by attribute values instead β€” lowkey a glow-up.

Defining the ryg color table based on the values in the attribute column AREA. Heads up: the attribute table is linked to layer 1.

v.to.db map=soils_general layer=1 option=area column=AREA
v.colors map=soils_general layer=1 color=wave use=attr column=AREA

🎨 Define color table stored as RGB values in attribute table

Here we write the color values into the attribute table (into the column GRASSRGB) instead of creating a color table. Different vibe, still iconic.

v.colors map=soils_general layer=1 color=wave use=attr column=AREA rgb_column=GRASSRGB
# See some GRASSRGB values:
v.db.select map=soils_general where="cat < 4"
cat|OBJECTID|AREA|PERIMETER|GSLNC250_|GSLNC250_I|GSL_NAME|GRASSRGB
1|1|0|164616.125|2|1|NC113|212:42:127
2|2|0|30785.529297|3|2|NC096|212:42:127
3|3|0|87572.882812|4|3|NC097|212:42:127

Look at those RGB triples, they're giving 212:42:127 πŸ’œ


πŸ” Convert RGB attribute values into color table

Converting your existing RGB values into actual color table rules:

v.colors -c map=soils_general rgb_column=GRASSRGB

Quick note bestie: in this case the vector map has a proper color table assigned (peep it with v.colors.out) together with the GRASSRGB attribute column. And also β€” important β€” the color table is preferred over the RGB values stored in the attribute table. So don't come for the color table, it wins. πŸ‘‘


πŸ¦‹ Transfer raster colors to vector

This one's the main character move, ngl.

# create an example raster from census blocks (10m pixel resolution)
g.region vector=censusblk_swwake res=10 -ap
v.to.rast input=censusblk_swwake use=attr attribute_column=TOTAL_POP output=censusblk_swwake_total_pop
r.colors -e map=censusblk_swwake_total_pop color=blues
# transfer raster colors to vector attributes (raster values to attributes)
r.colors.out map=censusblk_swwake_total_pop rules=- | v.colors map=censusblk_swwake use=attr column=TOTAL_POP rules=-
# equivalent, but simpler
v.colors map=censusblk_swwake use=attr column=TOTAL_POP raster=censusblk_swwake_total_pop
# transfer raster colors to vector categories (raster values to categories)
v.colors map=censusblk_swwake raster=censusblk_swwake_total_pop

That pipe in the middle? Chef's kiss. 🫢


πŸ—‘οΈ Remove existing color table

Wanna delete the color table? Pop the -r flag, it's over:

v.colors -r map=soils_general

But before you go removing anything, hear me out β€” you can save those color rules to a file first using v.colors.out, and assign them back later with the rules option. Save yourself the heartbreak πŸ’”

v.colors.out map=soils_general rules=soils.colr
v.colors map=soils_general rules=soils.colr

And to drop the RGB column entirely, that's a v.db.dropcolumn situation:

v.db.dropcolumn map=soils_general column=GRASSRGB
Never delete your color rules without backing them up first. No cap. 😭

πŸ‘€ SEE ALSO πŸ‘€

  • d.vect, r.colors, r.colors.out, r3.colors, r3.colors.out, v.colors.out

Also go check out the wiki page Color tables (from GRASS User Wiki) β€” it's giving study guide ✨

And ColorBrewer! It's an online tool designed to help people select good color schemes for maps and other graphics. Literally the aesthetic assistance bestie, obsessed. πŸŽ€


πŸ’– AUTHORS πŸ’–

  • Martin Landa, OSGeoREL, Czech Technical University in Prague, Czech Republic
  • Huidae Cho

Two absolute legends wrote this. Respect. πŸ‘‘


πŸ“¦ SOURCE CODE πŸ“¦

Available at: v.colors source code (history)

Latest change: Thursday Oct 23 20:57:28 2025 in commit: 938e5b09359caaeb9cfd62cb2c7e847218001627

Main index | Vector index | Topics index | Keywords index | Graphical index | Full index


That's the whole page bestie, we made it 🏁 This manual page is brought to you by the GRASS Development Team β€” Β© 2003-2026, straight out of GRASS 8.5.0 Reference Manual, and this v.colors(1grass) page is dated accordingly. Go color something. πŸ’…πŸŒˆ

πŸ“¦ where this page comes from