Skip to content
Agents tracked: 502 Releases (7d): 613 Agent status: 4 with issuesSince last limit reset: Claude 7d · Codex 5d For AI agents: Markdown Updated Nov 18, 2026

Textures.js

by Riccardo Scalco

JavaScript library for creating SVG patterns, built on d3.js for data visualization.

Backgrounds, patterns and shapes Code libraryOpen source

GitHub repoWebsite
A bar chart where each bar has its own fill (lines, dots, hexagons, grid, waves), next to sixteen swatches made with the settings shown on the project page, including a custom zigzag.
Made by AgentGid with textures 1.2.3 with d3-selection 3.0.0 (npm tarballs, hashes checked against the registry). Textures.js is MIT licensed, which allows showing its output; the chart data are made up.

2. Commercial use: github.com/riccardoscalco/textures

“## License MIT”

MIT allows use in paid products.

github.com/riccardoscalco/textures

License checked Nov 9, 2026 against 1 official page. Tap a verdict to see its source. How we checked Report an error

Textures.js: striped and dotted fills for charts

Textures.js is a small free code library that fills shapes with patterns such as stripes, dots, hexagons or waves instead of flat color. It is made for charts and maps drawn with the D3 toolkit, so groups can be told apart by pattern as well as by color. The patterns are SVG drawings and stay sharp at any size.

Where you can use it

Bars told apart by pattern

Bars told apart by pattern

Give each group in a bar or pie chart its own stripe, dot or grid fill, so readers can tell the groups apart even when colors look alike.

Show more and less with pattern size

Show an order, such as low, medium and high, with the same pattern in growing sizes. This works for heat levels on a map or risk levels in a table.

More groups with color plus pattern

When a chart has more groups than you have good colors, mix a few colors with a few patterns to get many clear combinations.

Your own pattern shape

Draw a small shape of your own, such as a zigzag or a chevron, and repeat it as a fill that matches your brand.

Charts that print in black and white Idea

Reports and handouts that may be printed without color keep their meaning, because each group has its own pattern.

Hatched areas on a map Idea

Mark areas on a map, such as flood zones or regions without data, with stripes over the normal map colors.

Textures.js popularity

37 / 100
Gid Score, same scale as developer tools
6,089
GitHub stars
8,514
npm downloads, last 7 days
+81.0% in 4 weeks
Textures.js: downloads per weeknpm, textures 8,514
Textures.js: GitHub starsriccardoscalco/textures 6,089

Downloads from api.npmjs.org, stars from GitHub, checked Nov 17, 2026. How the Gid Score is calculated

How to start

Tell your AI assistant

“Add textures 1.2.3 (pinned) to my D3 chart, give each category its own pattern fill with svg.call(texture) and fill texture.url(), and set a fixed .id() on each texture so the pattern ids stay the same between renders.”

Or install it yourself.

npm install textures
Show codeStep 1 or Step 2

Import it in your code; it needs D3 (or at least d3-selection) on the page to draw.

import textures from 'textures';

Mistakes to avoid

svg.append('rect').style('fill', texture.url()) without svg.call(texture) first
Call svg.call(texture) on the same svg before using texture.url() as a fill

call() is what writes the <pattern> into the svg; url() only returns its address, so the shape stays empty without it.

Relying on the automatic pattern ids when the chart is rendered on the server or exported to files
Give each texture a fixed id with .id('stripes-north') when the markup must be the same on every render

Without .id() each texture gets a random five-letter id at creation, so the markup changes on every render.

Trying to use textures with a canvas chart (Chart.js, ECharts canvas mode)
Use a chart that draws SVG (D3, or a library's SVG renderer)

The library only makes SVG patterns, which a canvas cannot use.

<script src="https://unpkg.com/textures@1.2.0/dist/textures.js"> copied from the README
Install textures@1.2.3 or download dist/textures.js into your project

The README link points to an older 1.2.0 build and makes every visitor load the file from an outside server.

License

MIT license. Free to use in personal and paid products, and you may change and share the code. When you ship copies of the library, keep its copyright and license notice with them.

Commercial use
Yes

“## License MIT” github.com/riccardoscalco/textures

Credit
Not needed

“## License MIT” github.com/riccardoscalco/textures

Inside your app or game
Can ship inside your app

“## License MIT” github.com/riccardoscalco/textures

Pass the files on to your users
With conditions

You may copy and pass on the library if the MIT notice goes with it; the patterns it draws in your charts are yours to show.

“The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.” LICENSE on GitHub

AI training
Not stated
Bots and bulk downloads
Not stated

AllowedWith conditionsNot allowedNot stated or not checked yet

Is Textures.js free for commercial use? The full answer Not legal advice. Check the license page before you ship.

For your agent

License rules tell your agent what it may do with Textures.js. Paste them into your prompt or AGENTS.md.

License rules
- Textures.js (Backgrounds, patterns and shapes). JavaScript library for creating SVG patterns, built on d3.js for data visualization. Price: free; commercial use OK; no credit needed.
  Connect: npm textures.
  Get files: npm install textures and use it with d3 (textures.lines(), circles(), paths()); generates SVG patterns (js, svg).
  Rule: Keep the MIT license notice with the library files you ship.
  Rule: Install from npm (textures) or download textures.js locally instead of relying on a CDN at runtime.
  Rule: Use it alongside d3 to generate SVG patterns.
  License: https://github.com/riccardoscalco/textures (checked 2026-11-09; details: https://agentgid.com/assets/textures-js/)
Can an agent use it by itself?
Yes.

Agent installs a package or loads it from a CDN.

Install
npm install textures
How an agent gets files
npm install textures and use it with d3 (textures.lines(), circles(), paths()); generates SVG patterns.

Formats: js, svg

API, key or account
Not needed. Everything runs on your side.
MCP server
None found
Credit line, if you want one
Patterns: Textures.js (MIT)
This card for machines

Alternatives

Textures.js This page

Free Commercial OK npm

Hero Patterns

Pick Hero Patterns when you want ready repeating background tiles for page sections, copied as CSS with your color, not fills inside a chart.

Free Commercial OK Download

Pattern Craft

Pick Pattern Craft for copy-paste CSS or Tailwind background patterns and gradients without D3 or any script.

Free Commercial OK Download

Pattern Monster

Pick Pattern Monster when you want to tune a seamless pattern in a web editor and download it as an SVG or PNG file.

Free tier Commercial OK MCP, API

React Bits

Animated React components, text effects and backgrounds in JS/TS with CSS or Tailwind; install the source with the shadcn CLI or jsrepo.

Free tier Commercial OK Download

Paper Shaders

Zero-dependency WebGL shader components: mesh gradients, grain, dithering, liquid metal, god rays, halftone, fluted glass; React or vanilla JS.

Free Commercial OK npm

All backgrounds, patterns and shapes

Questions

Do I need D3?

Yes. The library is built on top of D3 and adds its patterns through a D3 selection; the small d3-selection part is enough.

What kinds of patterns are there?

Three families, lines, circles and paths (hexagons, crosses, caps, woven, waves, nylon, squares), plus your own path shape.

Can I change colors and thickness?

Yes. Each texture has settings such as size, strokeWidth, stroke, fill, background and orientation, and heavier, lighter, thicker and thinner.

Can I use it in a paid product?

Yes. It is MIT licensed; keep the license notice with copies of the code.