CSS color-rendering Property

The color-rendering property is a legacy SVG property intended to provide hints about how browsers should optimize color rendering.

SVG 1.1 defined the values auto, optimizeSpeed, and optimizeQuality. These values were intended to express a preference between rendering performance and color quality, particularly for color interpolation and antialiasing.

Important: The property is not part of the current SVG 2 property definitions and has no reliable, interoperable effect in modern browsers. It should not be used to control color accuracy, gradient interpolation, or rendering performance in new projects.

color-rendering Syntax

Historically, the color-rendering property accepted three keyword values.

selector {
  color-rendering: auto;
}

Historical Syntax

selector {
  color-rendering: auto | optimizeSpeed | optimizeQuality;
}

Automatic Rendering

.svg-graphic {
  color-rendering: auto;
}

Optimize for Speed

.svg-graphic {
  color-rendering: optimizeSpeed;
}

Optimize for Quality

.svg-graphic {
  color-rendering: optimizeQuality;
}

SVG Presentation Attribute

<svg viewBox="0 0 200 100" color-rendering="optimizeQuality">
  <rect width="200" height="100" fill="#1769aa"></rect>
</svg>

CSS-Wide Keywords

Historical CSS declarations could also use CSS-wide keywords, subject to browser recognition of the property.

.svg-graphic {
  color-rendering: inherit;
}
.svg-graphic {
  color-rendering: initial;
}
.svg-graphic {
  color-rendering: unset;
}
.svg-graphic {
  color-rendering: revert;
}
.svg-graphic {
  color-rendering: revert-layer;
}

These examples document historical syntax. They do not establish that a modern browser implements the property.

Property Values

SVG 1.1 defined three values intended to provide rendering optimization hints.

Value Historical Description
auto Allows the browser to balance rendering quality and performance.
optimizeSpeed Suggests prioritizing rendering speed over color rendering quality.
optimizeQuality Suggests prioritizing color rendering quality over performance.

Historical Property Characteristics

Characteristic SVG 1.1 Definition
Initial value auto
Inherited Yes
Applies to SVG elements using color rendering
Values auto, optimizeSpeed, optimizeQuality
Percentages Not applicable
Current status Legacy SVG property, not defined as a property in SVG 2

The historical values were optimization hints, not instructions requiring a particular rendering algorithm.

How It Works

The original purpose of color-rendering was to communicate a preferred balance between color rendering speed and quality.

Step 1: Define an SVG Graphic

<svg viewBox="0 0 200 100">
  <rect width="200" height="100" fill="#1769aa"></rect>
</svg>

Step 2: Specify a Rendering Preference

.svg-graphic {
  color-rendering: optimizeQuality;
}

Step 3: Allow Browser Interpretation

Under the historical definition, the browser could consider the requested optimization preference when rendering SVG colors.

Step 4: Render the Graphic

The browser remained responsible for choosing its actual rendering implementation. The property did not define specific color calculations or quality thresholds.

Modern Behavior

Modern browsers should not be expected to honor these hints. An SVG graphic will generally render according to the browser's normal color processing behavior regardless of the specified color-rendering value.

auto Value

The historical auto value allowed the browser to choose its own balance between color rendering quality and performance.

.svg-graphic {
  color-rendering: auto;
}

Default Behavior

In SVG 1.1, auto was the initial value of the property.

SVG Example

<svg viewBox="0 0 200 100" color-rendering="auto">
  <rect width="200" height="100" fill="steelblue"></rect>
</svg>

Modern Usage

There is no practical need to add this declaration to new SVG graphics. Browsers already manage their rendering behavior without requiring this legacy hint.

optimizeSpeed Value

The historical optimizeSpeed value suggested that the browser prioritize rendering speed over color quality.

.svg-graphic {
  color-rendering: optimizeSpeed;
}

Historical Intent

The value was intended for situations where faster rendering was preferred, even if the browser used lower-quality color processing.

SVG Example

<svg viewBox="0 0 200 100" color-rendering="optimizeSpeed">
  <rect width="200" height="100" fill="steelblue"></rect>
</svg>

Performance Limitations

The value did not specify a particular optimization technique or guarantee faster rendering.

Modern Usage

Do not rely on optimizeSpeed to improve performance. Instead, simplify complex SVG paths, reduce unnecessary filter effects, and measure rendering performance using browser developer tools.

optimizeQuality Value

The historical optimizeQuality value suggested that the browser prioritize color rendering quality over speed.

.svg-graphic {
  color-rendering: optimizeQuality;
}

Historical Intent

The value was intended for SVG graphics where color quality was considered more important than rendering performance.

SVG Example

<svg viewBox="0 0 200 100" color-rendering="optimizeQuality">
  <rect width="200" height="100" fill="steelblue"></rect>
</svg>

Quality Limitations

The value did not define a required color profile, interpolation space, or antialiasing algorithm.

Modern Usage

Do not rely on optimizeQuality to improve SVG color accuracy. Use supported properties and color management features that directly control the intended rendering behavior.

SVG Usage

The color-rendering property originated in SVG and could be expressed using CSS or an SVG presentation attribute.

CSS Declaration

.svg-artwork {
  color-rendering: optimizeQuality;
}

SVG Presentation Attribute

<svg viewBox="0 0 240 120" color-rendering="optimizeQuality">
  <circle cx="60" cy="60" r="45" fill="#e85d75"></circle>
  <circle cx="140" cy="60" r="45" fill="#1769aa"></circle>
</svg>

Applying the Property to a Group

<svg viewBox="0 0 240 120">
  <g color-rendering="optimizeQuality">
    <circle cx="60" cy="60" r="45" fill="#e85d75"></circle>
    <circle cx="140" cy="60" r="45" fill="#1769aa"></circle>
  </g>
</svg>

Legacy SVG Files

Older SVG files may contain the property because it was defined in SVG 1.1. Its presence does not necessarily indicate an error, but it should not be interpreted as an effective modern rendering control.

New SVG Graphics

For new SVG graphics, omit the property unless maintaining compatibility with a specific legacy SVG workflow that requires it.

Inheritance

SVG 1.1 defined color-rendering as an inherited property. Under that historical model, descendants could inherit a rendering preference from their parent.

Parent Declaration

.svg-artwork {
  color-rendering: optimizeQuality;
}

Child Declaration

.svg-artwork {
  color-rendering: optimizeQuality;
}
.svg-artwork .fast-rendering {
  color-rendering: optimizeSpeed;
}

Explicit Inheritance

.svg-element {
  color-rendering: inherit;
}

Initial Value

.svg-element {
  color-rendering: initial;
}

In the historical SVG 1.1 definition, initial corresponded to auto.

Current Limitations

Because modern browsers do not reliably implement the legacy property, these inheritance examples should be treated as historical CSS behavior rather than a dependable rendering technique.

Several supported CSS and SVG properties provide more specific control over color processing and graphical rendering.

Property Purpose
color-interpolation Controls the interpolation color space for applicable SVG operations, including gradients.
color-interpolation-filters Controls the color space used by SVG filter primitives.
shape-rendering Provides rendering hints for SVG shapes, including geometric precision and crisp edges.
image-rendering Controls image scaling behavior, including pixelated rendering.
color Specifies the foreground text color and can supply the currentColor value.
color-scheme Indicates which light or dark color schemes an element supports.

color-interpolation

.svg-gradient {
  color-interpolation: linearRGB;
}

color-interpolation-filters

.svg-filter {
  color-interpolation-filters: sRGB;
}

shape-rendering

.svg-shape {
  shape-rendering: crispEdges;
}

image-rendering

.pixel-art {
  image-rendering: pixelated;
}

These properties address specific rendering operations. They are not direct replacements for the historical color-rendering optimization hints.

Modern Alternatives

Modern CSS and SVG provide more precise ways to control color interpolation, filter processing, and rendering appearance.

Control SVG Gradient Interpolation

.svg-gradient {
  color-interpolation: linearRGB;
}

Use color-interpolation when you need to specify how supported SVG gradients calculate intermediate colors.

Control SVG Filter Processing

.svg-filter-effect {
  color-interpolation-filters: sRGB;
}

Use color-interpolation-filters when a filter effect requires a particular RGB processing space.

Control CSS Gradient Interpolation

.gradient {
  background: linear-gradient(in oklab to right, red, blue);
}

Modern CSS gradients support explicit interpolation spaces through the in syntax.

Improve SVG Shape Rendering

.svg-shape {
  shape-rendering: geometricPrecision;
}

The shape-rendering property provides hints related to shape rendering rather than color management.

Improve Image Scaling

.pixel-art {
  image-rendering: pixelated;
}

Use image-rendering when the desired result depends on how raster images are scaled.

Improve Rendering Performance

For performance, reduce unnecessary SVG complexity, avoid excessive filter processing, and test actual rendering costs in browser developer tools.

Modern rendering optimization should be based on measurable results rather than unsupported legacy hints.

color-rendering Example

The following example shows three SVG graphics using the historical color-rendering values.

Each graphic uses the same gradient. Modern browsers may render all three identically because the legacy rendering hints are not reliably supported.

<div class="color-rendering-demo">
  <div class="rendering-item">
    <p>auto</p>
    <svg viewBox="0 0 180 100" role="img" aria-label="SVG gradient with automatic color rendering">
      <defs>
        <lineargradient id="render-auto">
          <stop offset="0%" stop-color="#e85d75"></stop>
          <stop offset="100%" stop-color="#1769aa"></stop>
        </lineargradient>
      </defs>
      <rect width="180" height="100" fill="url(#render-auto)" color-rendering="auto"></rect>
    </svg>
  </div>
  <div class="rendering-item">
    <p>optimizeSpeed</p>
    <svg viewBox="0 0 180 100" role="img" aria-label="SVG gradient with optimizeSpeed rendering hint">
      <defs>
        <lineargradient id="render-speed">
          <stop offset="0%" stop-color="#e85d75"></stop>
          <stop offset="100%" stop-color="#1769aa"></stop>
        </lineargradient>
      </defs>
      <rect width="180" height="100" fill="url(#render-speed)" color-rendering="optimizeSpeed"></rect>
    </svg>
  </div>
  <div class="rendering-item">
    <p>optimizeQuality</p>
    <svg viewBox="0 0 180 100" role="img" aria-label="SVG gradient with optimizeQuality rendering hint">
      <defs>
        <lineargradient id="render-quality">
          <stop offset="0%" stop-color="#e85d75"></stop>
          <stop offset="100%" stop-color="#1769aa"></stop>
        </lineargradient>
      </defs>
      <rect width="180" height="100" fill="url(#render-quality)" color-rendering="optimizeQuality"></rect>
    </svg>
  </div>
</div>
.color-rendering-demo {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
}
.color-rendering-demo .rendering-item {
  width: 180px;
  max-width: 100%;
}
.color-rendering-demo .rendering-item p {
  margin-bottom: 8px;
  font-weight: bold;
  text-align: center;
}
.color-rendering-demo svg {
  display: block;
  width: 100%;
  height: auto;
}
Browser Result

auto

optimizeSpeed

optimizeQuality

The three graphics are expected to look the same in most modern browsers. This illustrates why color-rendering should not be relied upon to change color quality or rendering performance.

For a visible comparison of different color interpolation methods, use the supported color-interpolation property with SVG gradients.

Important Considerations

Keep the following points in mind when encountering the color-rendering property:

  • Status: Legacy SVG property defined in SVG 1.1 but not retained as a property in SVG 2.
  • Purpose: Historically provided hints about color rendering speed and quality.
  • Values: auto, optimizeSpeed, and optimizeQuality.
  • Historical initial value: auto.
  • Historical inheritance: The property was inherited.
  • auto: Allowed the browser to select its preferred balance between performance and quality.
  • optimizeSpeed: Suggested prioritizing rendering speed.
  • optimizeQuality: Suggested prioritizing color rendering quality.
  • Browser behavior: Modern browsers do not reliably implement the property.
  • Performance: The property does not guarantee faster rendering.
  • Quality: The property does not guarantee more accurate colors.
  • SVG markup: The property may appear as a presentation attribute in older SVG files.
  • Gradient interpolation: Use color-interpolation for supported SVG gradient interpolation.
  • Filter processing: Use color-interpolation-filters for SVG filter color calculations.
  • New projects: Avoid depending on color-rendering.
  • Legacy projects: Retain it only when a specific workflow requires the historical markup.

For modern SVG development, use supported properties that directly control the rendering behavior you need. Treat color-rendering as a historical reference rather than an active optimization technique.

Browser Support

The color-rendering property has limited or no interoperable browser support. It should not be considered a dependable feature in modern browsers.

Browsers may ignore the property while continuing to render the SVG graphic normally.

Historical Declaration

.svg-graphic {
  color-rendering: optimizeQuality;
}

Fallback Behavior

If a browser does not recognize the property, it ignores the declaration. The SVG graphic can still render using its normal color processing behavior.

Compatibility Recommendation

Do not rely on this property for production rendering improvements. Use supported SVG and CSS properties instead.

For current compatibility information, visit Can I Use? and search for color-rendering.

Specifications

The color-rendering property was defined in SVG 1.1 as a rendering optimization hint.

SVG 1.1 - color-rendering Property

SVG 2 does not retain color-rendering as a defined property. Its historical values are included here for reference when maintaining older SVG content.

SVG 2 Specification