Gis, Qgis, ArcGis  Experts Just a Click Away

Custom Color Ramps in QGIS

Custom Color Ramps in QGIS: Create, Classify, Save, and Share Styles

Custom color ramps in QGIS help you communicate continuous measurements, ordered classes, and categorical groups more clearly. A well-designed ramp can make elevation, temperature, population, rainfall, NDVI, land cover, or risk data easier to interpret. A poor ramp can hide patterns, exaggerate differences, imply an order that does not exist, or become unreadable for people with color-vision deficiencies.

QGIS provides color ramps through the Style Manager and through layer symbology dialogs. You can create gradient ramps, color presets, random ramps, ColorBrewer ramps, and cpt-city ramps, then save them to a style database for reuse. You can also save complete layer styles so that the classification method, class breaks, labels, transparency, and legend settings travel with the map.

What is a color ramp?

A color ramp is a sequence or function that assigns colors to data values or classes.

It is used differently depending on the renderer:

  • Continuous or linear: values receive smoothly interpolated colors between stops.
  • Discrete: values receive a defined class color without implying smooth transitions.
  • Categorical: named classes receive distinct colors.
  • Random: QGIS generates multiple colors, usually for categories when no ordered meaning should be implied.

A color ramp does not change the data. It changes how the layer is rendered and how the map reader perceives the values.

Choose the ramp type from the data

Sequential data

Use a sequential ramp when low-to-high values have an ordered meaning. Examples include:

  • Elevation
  • Population density
  • Rainfall
  • Concentration
  • NDVI magnitude
  • Distance
  • Number of incidents

A sequential ramp normally moves from a lighter or less prominent color to a darker or more prominent color. Use a perceptually coherent progression rather than several unrelated hues.

Diverging data

Use a diverging ramp when a meaningful midpoint separates two directions, such as:

  • Temperature anomaly below and above zero
  • Change from loss to gain
  • Difference from a target value
  • Negative to positive residuals
  • Deficit to surplus

A diverging ramp should make the midpoint visually identifiable. Set the class breaks or continuous range so that the midpoint is not accidentally placed away from the meaningful reference value.

Qualitative or categorical data

Use a qualitative palette for classes without a natural order, such as:

  • Land-cover type
  • Soil class
  • Zoning category
  • Administrative region
  • Facility type
  • Survey response

Do not use a sequential ramp for unrelated categories. A dark color should not accidentally imply that one land-cover class is “more” than another.

Cyclic data

Some variables wrap around at a boundary, such as aspect or direction. A standard sequential ramp can create a false discontinuity. Use a cyclic color design only when the variable and legend support it, and explain the interpretation.

Random ramps

Random color ramps can help distinguish many categories quickly, but they are not appropriate for ordered values. They can also create poor contrast or colors that are difficult to distinguish. Review and edit the result before publication.

QGIS color-ramp types

The QGIS Style Manager currently supports several ramp-creation options.

Gradient

A gradient starts with color stops and interpolates between them. You can add intermediate stops to create a multi-stage ramp.

Use Gradient for:

  • Continuous measurements
  • Sequential schemes
  • Diverging schemes
  • Terrain-like multi-hue designs
  • Ramps that require precise control over positions and colors

Color presets

Color presets are lists of selected colors. They are useful for categorical palettes or for a fixed set of manually chosen class colors.

Random

Random ramps generate a specified number of colors from hue, saturation, value, opacity, and class settings. Review the generated palette for distinguishability and accessibility.

ColorBrewer

QGIS includes ColorBrewer catalog ramps for established sequential, diverging, and qualitative schemes. Select the number of classes that matches the data and intended output. A palette designed for five classes should not automatically be stretched to twenty categories.

cpt-city

The cpt-city catalog provides many themed gradients. Treat these as design resources, not as automatic scientific defaults. Check whether the selected gradient suggests an unintended meaning or has poor print and accessibility performance.

Create a custom gradient color ramp

The exact button appearance can vary slightly by QGIS version, but the workflow is consistent.

Step 1: Open Style Manager

  1. Open QGIS.
  2. Open Settings → Style Manager.
  3. Select the Color ramp tab.
  4. Choose the style database or project style collection where the ramp should be stored.

The Style Manager stores generic style items such as symbols, color ramps, text formats, and label settings. The default style database is stored in the active QGIS user profile, while project styles can be used for project-specific resources. 1

Step 2: Add a gradient

  1. Click Add item.
  2. Choose Gradient.
  3. Set the initial and final colors.
  4. Double-click the ramp preview to add intermediate color stops.
  5. Select a stop and adjust its relative position.
  6. Edit the color properties.
  7. Remove stops that are not needed.
  8. Give the ramp a descriptive name.
  9. Add tags or mark it as a favorite if useful.
  10. Save the ramp.

A descriptive name might be:

NDVI - masked - diverging not applicable
Elevation - blue green brown white
Population density - light to dark blue
Temperature anomaly - blue white red

Avoid names such as test, new ramp, or final2.

Step 3: Add meaningful color stops

Color stops control where the ramp changes. For example, a diverging anomaly ramp might use:

Relative positionPurpose
0.00Strong negative value
0.25Moderate negative value
0.50Meaningful midpoint
0.75Moderate positive value
1.00Strong positive value

The stop positions are relative to the ramp, not automatically the actual data values. The layer’s renderer and classification settings determine how data values map to the ramp.

Step 4: Choose interpolation carefully

QGIS gradient ramps can use RGB, HSL, or HSV interpolation. 1

  • RGB interpolation blends red, green, and blue channel values. It is predictable but can produce muted intermediate colors.
  • HSL or HSV interpolation can create more visually vivid transitions, but hue direction and saturation changes should be inspected.
  • Hue interpolation can be clockwise or counterclockwise in HSL or HSV settings.

Do not describe QGIS’s current built-in gradient interpolation as LAB interpolation unless you have verified that a specific plugin or custom workflow provides it. Perceptual uniformity is a design goal, not a guarantee from simply selecting a color space.

Step 5: Check opacity

Opacity can be useful for overlays, but a ramp that changes both color and opacity can make the data appear to disappear. Use transparency intentionally and explain it in the legend or map notes.

For most analytical thematic maps, keep opacity consistent and control layer-level transparency separately.

Create a categorical color preset

Use a color preset when the categories are distinct and unordered.

  1. Open Settings → Style Manager.
  2. Select Color ramp.
  3. Choose Add item → Color presets.
  4. Add the required colors.
  5. Use distinct but sufficiently contrasting colors.
  6. Save the preset with a descriptive name.

The number of categories should match the number of colors where possible. If many categories exist, consider grouping minor categories into “Other,” using labels, or choosing a different visualization rather than creating an unreadable palette.

Apply a custom ramp to a raster layer

Singleband pseudocolor

For a continuous single-band raster such as a DEM, rainfall, temperature, or NDVI:

  1. Add the raster to QGIS.
  2. Open Layer Properties or the Layer Styling panel.
  3. Select the Symbology tab.
  4. Choose Singleband pseudocolor.
  5. Select the custom color ramp.
  6. Review the minimum and maximum values.
  7. Select an interpolation method.
  8. Choose a classification mode if required.
  9. Click Classify.
  10. Apply the style and inspect the map.

QGIS’s raster color-ramp shader supports discrete, linear, and exact interpolation. It also supports classification modes such as equal interval, continuous, and quantile. 2

Set the data range deliberately

QGIS may estimate the minimum and maximum from the raster. Confirm whether the range includes:

  • NoData or fill values
  • Outliers
  • A very small valid subset
  • Values outside the study area
  • Different units than expected

For a comparison map, use a documented fixed range. For an exploratory map, an estimated range can be useful, but it should not be treated as a stable analytical classification.

Discrete, linear, and exact interpolation

Discrete

A cell receives the color from the closest color-map entry at or above its value. Use discrete interpolation when the map should show defined steps.

Linear

A cell receives a color interpolated between the entries above and below its value. Use linear interpolation for continuous surfaces when smooth variation is meaningful.

Exact

Only pixels whose values exactly match a color-map entry are rendered. Use this for specific coded values or exact class values, not for ordinary continuous data.

Classification modes

Equal interval

The range is divided into intervals of equal numeric width. This is easy to explain and useful when the measurement scale itself matters, but it can leave some classes nearly empty in skewed data.

Quantile

Each class contains approximately the same number of pixels or elements. Quantile can make a map visually balanced but can place very similar values in different classes and different values in the same class.

Continuous

Class limits and colors follow the stops in the selected ramp. This is useful when the ramp has deliberately placed transitions.

Handle NoData and out-of-range values

Check the raster’s NoData definition and the additional NoData settings. QGIS allows NoData values to be displayed transparently or with a chosen color. 2

For linear interpolation, decide whether to clip values outside the configured minimum and maximum. If values outside the range are meaningful, do not hide them accidentally. If the range is intentionally fixed for comparison, document how out-of-range values are handled.

Apply a custom ramp to vector data

Graduated renderer

Use Graduated symbology when an attribute or expression has ordered numeric meaning.

  1. Open the vector layer’s Layer Properties.
  2. Select Symbology.
  3. Choose Graduated.
  4. Select the field or expression.
  5. Choose Color as the symbol change method.
  6. Select the custom color ramp.
  7. Set the number of classes.
  8. Choose a classification mode.
  9. Click Classify.
  10. Review and edit class breaks and labels.
  11. Apply the renderer.

QGIS supports classification modes including Equal Count (Quantile), Equal Interval, Fixed Interval, Logarithmic Scale, Natural Breaks (Jenks), and Pretty Breaks for graduated rendering. 3

Use the mode that matches the analytical question rather than choosing the mode that produces the prettiest map.

Categorized renderer

Use Categorized symbology for a discrete field such as land-cover class, zoning type, or facility category. A categorical color preset is often more appropriate than a continuous gradient.

Review:

  • Category names
  • Null values
  • Rare classes
  • Similar colors assigned to adjacent categories
  • Legend order
  • Number of categories

If category order has a meaningful sequence, consider whether a graduated or rule-based representation is more informative.

Rule-based or data-defined styling

A color ramp is not a replacement for rule-based logic. Use expressions or rule-based symbology when colors depend on several conditions, such as:

  • Risk category and confidence
  • Land use and protected status
  • Value and data quality
  • Feature type and construction status

QGIS also supports data-defined symbol properties and expressions. This is different from modifying a saved color ramp itself.

Save the ramp versus save the whole layer style

These are different operations.

Save a color ramp in Style Manager

Saving a ramp places it in a style database or project style collection so it can be selected in later symbology dialogs.

Save a layer style

A layer style can include:

  • Renderer
  • Color ramp
  • Class breaks
  • Class labels
  • Symbol properties
  • Labeling
  • Transparency
  • Diagrams
  • Forms and other layer properties

Use the layer’s style menu to save or export the complete configuration. QGIS documentation describes saving full or partial layer properties to files, the clipboard, or databases. 4

A ramp alone does not preserve the field, renderer, breaks, labels, NoData settings, or classification mode used by a specific map.

Save as a QML style

A .qml file is useful when you want to move a layer’s styling between projects or apply the same style to a compatible layer. The target layer should have compatible fields, geometry, data type, and value meaning.

A style can load successfully while still being semantically wrong if it references a missing field or applies thresholds from a different dataset.

Share custom ramps with a team

The Style Manager provides import and export capabilities for sharing style items. 1

A practical team workflow is:

  1. Create and review the ramp.
  2. Give it a versioned name.
  3. Add tags such as elevation, diverging, print, or organization-standard.
  4. Export the selected style item or style database according to the QGIS version and workflow.
  5. Test the shared style in a clean QGIS profile.
  6. Distribute the ramp together with a short usage note.
  7. Store the exported style artifact in version control or the team’s approved repository.

Document:

  • Intended data type
  • Sequential, diverging, or qualitative meaning
  • Suggested minimum and maximum
  • Number of classes
  • Recommended renderer
  • Print or web limitations
  • Accessibility test result
  • Version and owner

Do not rely on the recipient having the same local QGIS profile. The style database is profile-specific, while an exported style artifact can be transferred deliberately.

Use a perceptual and accessible design

Do not rely on color alone

Use labels, patterns, outlines, line styles, shapes, or annotations where the distinction is important. A map should remain understandable when printed in grayscale or viewed by someone with color-vision deficiency.

Check contrast

Colors need sufficient contrast against the basemap, polygon outlines, labels, and neighboring classes. Small differences that look clear on a large monitor may disappear in a PDF or printed report.

Avoid red-green as the only distinction

Red-green ramps are difficult for many viewers to distinguish. A blue-to-yellow or purple-to-orange scheme may be more robust, but every palette should be tested rather than assumed to be accessible.

Test grayscale and color-vision simulation

Review the map:

  • In grayscale
  • At the intended print size
  • On the intended display
  • With a color-vision simulation tool
  • At normal and reduced zoom levels

The purpose is not to make every color identical across devices. It is to ensure that the map’s key distinctions remain understandable.

Use appropriate map conventions carefully

Blue may suggest water, green vegetation, and red danger, but conventions are not universal. Use intuitive associations when they help, and add an explicit legend and title.

Data-type examples

Elevation

A terrain ramp can move from darker lowlands through green and brown to light or white high elevations. Avoid using a simple rainbow ramp when exact elevation comparisons matter; hue changes can create artificial boundaries.

Consider:

  • A fixed elevation range
  • A hillshade underneath or above the elevation layer
  • Consistent units
  • A clearly labeled legend
  • Separate handling for below-sea-level values

Temperature anomaly

Use a diverging ramp with a neutral midpoint at zero. Do not use a sequential palette for values that represent both warming and cooling.

NDVI

Use a documented range and mask invalid pixels before styling. A green ramp can be intuitive, but a legend must make clear whether the map shows raw NDVI, a class, or a change value.

Population density

Use a sequential ramp, consider skewed distributions, and test whether quantile classification overemphasizes relatively small differences in sparsely populated areas.

Land cover

Use a qualitative palette. Use stable class colors across dates and maps so that forest, water, urban, cropland, and wetland do not change colors from one figure to the next.

Risk or priority

If the values represent ordered risk categories, use a sequential or diverging scheme with clear labels. If risk classes are nominal rather than ordered, use categorical colors.

Classification choices matter as much as the ramp

Changing class breaks can alter the map’s message even when the colors are identical.

Equal interval

Best when the numeric interval has direct meaning or when communicating a measurement scale. It can produce empty or visually unbalanced classes with skewed data.

Quantile

Best when you want a similar number of features or pixels in each class. It can split nearly identical values and make small differences appear important.

Natural breaks

Useful when the data has clusters or gaps. The breaks are data-dependent, so the same thresholds may not be reproduced for another date or area.

Fixed interval

Useful for standards, policy thresholds, engineering limits, or a consistent legend across multiple maps.

Logarithmic scale

Useful for strongly skewed values spanning orders of magnitude. Confirm that a log transformation makes sense for zero and negative values before using it.

Always record the classification mode, number of classes, field or expression, minimum and maximum, and manually edited breaks.

Common problems and solutions

The custom ramp does not appear

Check:

  • The ramp was saved rather than only previewed.
  • You are connected to the correct style database.
  • The ramp is not hidden by a tag or filter.
  • The active QGIS user profile is the one where it was created.
  • The project is using Project Styles rather than the Default database.

The ramp is reversed

Use the invert color-ramp option where available or reverse the color-stop order. Check that the legend’s low and high values match the intended meaning.

The map looks banded

You may be using discrete interpolation or a small number of classes. Use linear interpolation for genuinely continuous data, or retain discrete classes if the bands are analytically intentional.

Do not simply add more colors to hide poor data resolution or a poor classification choice.

All features have the same color

Check:

  • The selected field is numeric when using Graduated.
  • The field is not entirely null.
  • The value expression returns varied results.
  • The minimum and maximum are not identical.
  • The renderer was classified after changing the field.

Category colors change unexpectedly

QGIS may assign colors based on category order. Review and manually lock important category colors, then save the complete layer style.

Colors look different in a PDF or print

Check output color management, transparency, blending, raster resampling, and printer behavior. Test the actual PDF or printed page, not only the map canvas.

NoData is shown as a data color

Inspect the raster’s NoData and additional NoData settings. Set an intentional NoData display color or transparency. Never let a fill value such as -9999 dominate the legend or stretch.

The legend does not match the map

Review continuous versus discrete legend settings, class labels, minimum and maximum labels, number formatting, and whether the map has been refreshed after changing the renderer. QGIS allows customized continuous and class-based raster legends. 2

A style loads but the map is wrong

The style may refer to a missing field, different units, a different value range, or a different data type. A successful import is not proof that the style is semantically compatible.

A repeatable style-development workflow

Use this process for an organization-standard ramp:

  1. Define the data meaning and intended audience.
  2. Choose sequential, diverging, qualitative, or cyclic logic.
  3. Select a candidate palette.
  4. Create the ramp in the Style Manager.
  5. Test it on representative low, middle, high, and outlier values.
  6. Apply the intended renderer.
  7. Set classification breaks or continuous limits.
  8. Test grayscale, print, and color-vision accessibility.
  9. Check labels and legend wording.
  10. Save the ramp and complete layer style.
  11. Export and test in a clean QGIS profile.
  12. Record version, owner, units, thresholds, and intended use.
  13. Use the same ramp and breaks consistently across related maps.

Frequently asked questions

Where do I create a custom color ramp in QGIS?

Open Settings → Style Manager, select Color ramp, click Add item, and choose a ramp type such as Gradient, Color presets, Random, ColorBrewer, or cpt-city. 1

Can I use a custom ramp for raster and vector layers?

Yes. Color ramps can be used in raster color-ramp shaders, vector Graduated symbology, categorized styles where appropriate, and other QGIS rendering workflows.

What is the difference between a gradient ramp and a color preset?

A gradient ramp interpolates between color stops and is suited to continuous values. A color preset is a list of selected colors and is suited to fixed classes or categories.

Should I use RGB, HSL, or HSV interpolation?

Use the option that produces the intended visual transition and test the intermediate colors. RGB, HSL, and HSV interpolation can produce different midpoints and hue behavior. 1

Does QGIS support LAB color interpolation by default?

The current QGIS Style Manager documentation describes RGB, HSL, and HSV interpolation for gradient color stops. Do not assume LAB interpolation is available in the default dialog merely because it is desirable for perceptual design.

How do I save a custom ramp for future projects?

Save it in the Style Manager’s Default style database or an appropriate project style collection. The Style Manager stores style items in a profile-based style database and supports sharing through import and export. 1

How do I share an entire map style?

Save or export the complete layer style, such as a QML style, rather than exporting only the color ramp. This preserves the renderer, field, breaks, labels, and other layer properties where supported. 4

What is the best ramp for elevation?

There is no universal best ramp. Use a sequential terrain-oriented design, document units and range, and test it alongside hillshade and the intended basemap. Avoid implying that hue changes are physical boundaries.

What is the best ramp for land cover?

Use a qualitative palette with stable colors for the major classes. Do not use a continuous gradient that implies an order between unrelated land-cover types.

What is the best ramp for values above and below zero?

Use a diverging ramp with a meaningful neutral midpoint, usually zero or a policy target. Ensure the numeric range is balanced around that midpoint when the comparison requires it.

Why do my class colors not match another map?

The maps may use different classification modes, class breaks, ranges, data subsets, category orders, or styles. To reproduce a map, record and transfer the full style and classification settings, not only the color ramp.

Can I create a color ramp from an expression?

Expressions can drive data-defined colors or other symbol properties, but that is different from creating a reusable Style Manager color ramp. Use expressions when the color depends on multiple fields or rules.

Conclusion

Creating a custom color ramp in QGIS is more than choosing attractive colors. First decide whether the data is sequential, diverging, qualitative, or cyclic. Then choose a suitable ramp type, set color stops and interpolation, configure the renderer and classification, check NoData and outliers, and test the result at the intended display or print size.

Save the ramp in the Style Manager for reuse, and save the complete layer style when you need to preserve the renderer, breaks, labels, transparency, and legend. Document the ramp’s meaning and test it for accessibility so that the map communicates the data rather than merely decorating it.

References

[1] QGIS User Guide: Style Manager and color ramps

[2] QGIS User Guide: Raster symbology and color-ramp classification

[3] QGIS User Guide: Vector symbology and graduated classification

[4] QGIS User Guide: Vector properties and custom layer styles

[5] ColorBrewer 2.0

[6] W3C WAI: Use of Color

Leave a Reply

Gabby Jones

Typically replies within a minute

Hello, Welcome to the site. Please click below button for chating me throught WhatsApp.