Color is pretty good for separating things. That’s what your basic pie chart is, isn’t it? You tell the slices apart by color. With enough color contrast, you might be OK, but you might be even better off (particularly where accessibility is concerned) using patterns, or a combination.
Patrick Dillon tackled the Pie Chart thing
Enhancing Charts With SVG Patterns:
When one of the slices is filled with something more than color, it’s easier to figure out [who the Independents are]:
See the Pen Political Party Affiliation – #2 by Patrick Dillon (@pdillon) on CodePen.
Filling a pie slice with a pattern is not a common charting library feature (yet), but if your library of choice is SVG-based, you are free to implement SVG patterns.
As in, literally a <pattern />
in SVG!
Here’s a simple one for horizontal lines:
<pattern
id="horzLines"
width="8"
height="4"
patternUnits="userSpaceOnUse">
<line
x1="0"
y1="0"
x2="8"
y2="0"
style="stroke:#999;stroke-width:1.5"
/>
</pattern>
Now any SVG element can use that pattern as a fill. Even strokes. Here’s an example of mixed usage of two simple patterns:
See the Pen Simple Line Patterns by Chris Coyier (@chriscoyier) on CodePen.
That’s nice for filling SVG elements, but what about HTML elements?
Irene Ros created Pattern Fills that are SVG based, but usable in CSS also.
There are several ways to use Pattern Fills:
You can use the
patterns.css
file that contains all the current patterns. That will only work for non-SVG elements.You can use individual patterns, but copying them from the sample pages. CSS class definitions can be found here and SVG pattern defs can be found here
You can add your own patterns or modify mine! The conversion process from SVG document to pattern is very tedious. The purpose of the pattern fills toolchain is to simplify this process. You can clone the repo, run
npm install
andgrunt dev
to get a local server going. After that, any changes or additions to thesrc/patterns/**/*
files will be automatically picked up and will re-render the CSS file and the sample pages. If you make new patterns, send them over in a pull request!

Here’s me applying them to SVG elements (but could just as easily be applied to HTML elements):
See the Pen Practical Patterns by Chris Coyier (@chriscoyier) on CodePen.
The CSS usage is as base64 data URLs though, so once they are there they aren’t super duper manageable/changeable.
Here’s Irene with an old timey chart, using d3:

Managing an SVG pattern in CSS
If your URL encode the SVG just right, you and plop it right into CSS and have it remain fairly managable.
See the Pen Simple Line Patterns by Chris Coyier (@chriscoyier) on CodePen.
Other Examples Combining Color
Here’s one by John Schulz:
See the Pen SVG Colored Patterns by Chris Coyier (@chriscoyier) on CodePen.
Ricardo Marimón has an example creating the pattern in d3. The pattern looks largely the same on the slices, but perhaps it’s a start to modify.
Other Pattern Sources
We rounded a bunch of them up recently!

So … turn this in kind of a Subtle Pattern collection? ;)
Just with SVG …
cu, w0lf.
Yes, patterns are an option to mark differentiation and support the ‘color-only’ criteria. However, you have to tread very cautiously. Certain patterns can trigger discomfort for various cognitive, neurological and psychological conditions and states. For example, diagonal lines can trigger vestibular disorders when scrolling the page, and make reading more difficult for those with dyslexia.
Agreed. In addition, you have to be careful to use a set of patterns that are (a) easily recognizable and (b) sufficiently distinct from one another. For example, in Irene Ros’ pattern set, there are four patterns that use different sized round dots. The size of the dots varies only slightly from one to the other. If all four were used in the same chart (perhaps with a legend, even), it could be difficult to understand which value a particular size of dots indicates.
This is very interesting. Between you and Sara Soueidan, I’m learning all kinds of ways to use SVG. Gotta build up my mental model so I know where to reach for solutions.