{
 "slug": "textures-js",
 "name": "Textures.js",
 "author": "Riccardo Scalco",
 "density": "full",
 "status": "active",
 "status_note": null,
 "alternatives_page": null,
 "one_liner": "JavaScript library for creating SVG patterns, built on d3.js for data visualization.",
 "category": {
  "slug": "backgrounds-patterns",
  "name": "Backgrounds, patterns and shapes"
 },
 "tags": [
  "Code library",
  "Open source"
 ],
 "styles": [],
 "logo_url": "https://agentgid.com/media/avatars/riccardoscalco.png",
 "logo_letter": "T",
 "links": {
  "repo": "https://github.com/riccardoscalco/textures",
  "website": "https://riccardoscalco.it/textures/",
  "api_docs": null
 },
 "preview": {
  "kind": "image_grid",
  "src": "https://agentgid.com/assets/textures-js/demo.jpg",
  "alt": "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.",
  "caption": "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."
 },
 "verdicts": [
  {
   "key": "price",
   "label": "Price",
   "value": "Free",
   "status": "yes",
   "sub": "No paid plan",
   "quote": null,
   "note": "Free open-source library under the MIT license.",
   "source": {
    "label": "riccardoscalco.it/textures",
    "url": "https://riccardoscalco.it/textures/"
   },
   "n": 1
  },
  {
   "key": "commercial",
   "label": "Commercial use",
   "value": "Yes",
   "status": "yes",
   "sub": "MIT",
   "quote": "## License MIT",
   "note": "MIT allows use in paid products.",
   "source": {
    "label": "github.com/riccardoscalco/textures",
    "url": "https://github.com/riccardoscalco/textures"
   },
   "n": 2
  },
  {
   "key": "credit",
   "label": "Credit the author",
   "value": "Not needed",
   "status": "yes",
   "sub": "Keep the notice in code copies",
   "quote": "## License MIT",
   "note": "No credit on screen. Keep the license notice inside the code you ship.",
   "source": {
    "label": "github.com/riccardoscalco/textures",
    "url": "https://github.com/riccardoscalco/textures"
   },
   "n": 3
  },
  {
   "key": "agent_access",
   "label": "Agent access",
   "value": "npm package",
   "status": "info",
   "sub": "Installs without a key",
   "quote": null,
   "note": "An agent can install it by itself with npm install textures. No key or account is needed.",
   "source": {
    "label": "github.com/riccardoscalco/textures",
    "url": "https://github.com/riccardoscalco/textures"
   },
   "n": 4
  }
 ],
 "license": {
  "name": "MIT",
  "url": "https://github.com/riccardoscalco/textures",
  "summary": "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.",
  "pages_read": 1,
  "rules": [
   "Keep the MIT license notice with the library files you ship.",
   "Install from npm (textures) or download textures.js locally instead of relying on a CDN at runtime.",
   "Use it alongside d3 to generate SVG patterns."
  ],
  "rows": [
   {
    "label": "Commercial use",
    "value": "Yes",
    "status": "yes",
    "quote": "## License MIT",
    "source": {
     "label": "github.com/riccardoscalco/textures",
     "url": "https://github.com/riccardoscalco/textures"
    },
    "note": null
   },
   {
    "label": "Credit",
    "value": "Not needed",
    "status": "yes",
    "quote": "## License MIT",
    "source": {
     "label": "github.com/riccardoscalco/textures",
     "url": "https://github.com/riccardoscalco/textures"
    },
    "note": null
   },
   {
    "label": "Inside your app or game",
    "value": "Can ship inside your app",
    "status": "yes",
    "quote": "## License MIT",
    "source": {
     "label": "github.com/riccardoscalco/textures",
     "url": "https://github.com/riccardoscalco/textures"
    },
    "note": null
   },
   {
    "label": "Pass the files on to your users",
    "value": "With conditions",
    "status": "cond",
    "quote": "The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.",
    "source": {
     "label": "LICENSE on GitHub",
     "url": "https://github.com/riccardoscalco/textures/blob/HEAD/license"
    },
    "note": "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."
   },
   {
    "label": "AI training",
    "value": "Not stated",
    "status": "unknown",
    "quote": null,
    "source": null,
    "note": null
   },
   {
    "label": "Bots and bulk downloads",
    "value": "Not stated",
    "status": "unknown",
    "quote": null,
    "source": null,
    "note": null
   }
  ],
  "checked_at": "2026-11-09",
  "commercial_use_page": "https://agentgid.com/assets/textures-js/commercial-use/"
 },
 "overview": {
  "heading": "Textures.js: striped and dotted fills for charts",
  "body": "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."
 },
 "uses": [
  {
   "title": "Bars told apart by pattern",
   "text": "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.",
   "idea": false,
   "image": "https://agentgid.com/assets/textures-js/demo.jpg"
  },
  {
   "title": "Show more and less with pattern size",
   "text": "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.",
   "idea": false,
   "image": null
  },
  {
   "title": "More groups with color plus pattern",
   "text": "When a chart has more groups than you have good colors, mix a few colors with a few patterns to get many clear combinations.",
   "idea": false,
   "image": null
  },
  {
   "title": "Your own pattern shape",
   "text": "Draw a small shape of your own, such as a zigzag or a chevron, and repeat it as a fill that matches your brand.",
   "idea": false,
   "image": null
  },
  {
   "title": "Charts that print in black and white",
   "text": "Reports and handouts that may be printed without color keep their meaning, because each group has its own pattern.",
   "idea": true,
   "image": null
  },
  {
   "title": "Hatched areas on a map",
   "text": "Mark areas on a map, such as flood zones or regions without data, with stripes over the normal map colors.",
   "idea": true,
   "image": null
  }
 ],
 "start": {
  "prompt": "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.",
  "install": "npm install textures",
  "install_note": null,
  "code": [
   {
    "tab": "Step 1",
    "intro": "Import it in your code; it needs D3 (or at least d3-selection) on the page to draw.",
    "source": "import textures from 'textures';"
   },
   {
    "tab": "Step 2",
    "intro": "Make a texture, add it to the svg with call(), then use its url() as the fill of a shape.",
    "source": "const svg = d3\n  .select('#example')\n  .append(\"svg\");\n\nconst texture = textures\n  .lines()\n  .thicker();\n\nsvg.call(texture);\n\nsvg\n  .append('circle')\n  .style('fill', texture.url());"
   }
  ]
 },
 "mistakes": [
  {
   "dont": "svg.append('rect').style('fill', texture.url()) without svg.call(texture) first",
   "fix": "Call svg.call(texture) on the same svg before using texture.url() as a fill",
   "why": "call() is what writes the <pattern> into the svg; url() only returns its address, so the shape stays empty without it.",
   "dont_code": false,
   "fix_code": false
  },
  {
   "dont": "Relying on the automatic pattern ids when the chart is rendered on the server or exported to files",
   "fix": "Give each texture a fixed id with .id('stripes-north') when the markup must be the same on every render",
   "why": "Without .id() each texture gets a random five-letter id at creation, so the markup changes on every render.",
   "dont_code": false,
   "fix_code": false
  },
  {
   "dont": "Trying to use textures with a canvas chart (Chart.js, ECharts canvas mode)",
   "fix": "Use a chart that draws SVG (D3, or a library's SVG renderer)",
   "why": "The library only makes SVG patterns, which a canvas cannot use.",
   "dont_code": false,
   "fix_code": false
  },
  {
   "dont": "<script src=\"https://unpkg.com/textures@1.2.0/dist/textures.js\"> copied from the README",
   "fix": "Install textures@1.2.3 or download dist/textures.js into your project",
   "why": "The README link points to an older 1.2.0 build and makes every visitor load the file from an outside server.",
   "dont_code": true,
   "fix_code": false
  }
 ],
 "agent": {
  "self_serve": true,
  "self_serve_text": "Agent installs a package or loads it from a CDN",
  "install": "npm install textures",
  "repo": "https://github.com/riccardoscalco/textures",
  "api_docs": null,
  "api_account": "Not needed. Everything runs on your side.",
  "get_files": "npm install textures and use it with d3 (textures.lines(), circles(), paths()); generates SVG patterns.",
  "formats": [
   "js",
   "svg"
  ],
  "limits": null,
  "mcp": null,
  "mcp_url": null,
  "credit_line": "Patterns: Textures.js (MIT)",
  "rules_text": "- 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.\n  Connect: npm textures.\n  Get files: npm install textures and use it with d3 (textures.lines(), circles(), paths()); generates SVG patterns (js, svg).\n  Rule: Keep the MIT license notice with the library files you ship.\n  Rule: Install from npm (textures) or download textures.js locally instead of relying on a CDN at runtime.\n  Rule: Use it alongside d3 to generate SVG patterns.\n  License: https://github.com/riccardoscalco/textures (checked 2026-11-09; details: https://agentgid.com/assets/textures-js/)",
  "agent_md": "https://agentgid.com/assets/textures-js/agent.md",
  "card_json": "https://agentgid.com/assets/textures-js/card.json"
 },
 "popularity": {
  "gid_score": 37,
  "stars": 6089,
  "downloads_7d": 8514,
  "downloads_7d_label": "8,514",
  "downloads_change_4w_pct": 81.0,
  "eco": "npm",
  "package": "textures",
  "repo": "riccardoscalco/textures",
  "agent_projects": null,
  "agent_projects_total": null,
  "downloads_unconfirmed": false,
  "series": {
   "downloads_weekly": [
    [
     "2025-11-17",
     3487
    ],
    [
     "2025-11-24",
     2755
    ],
    [
     "2025-12-01",
     3529
    ],
    [
     "2025-12-08",
     3573
    ],
    [
     "2025-12-15",
     3210
    ],
    [
     "2025-12-22",
     1600
    ],
    [
     "2025-12-29",
     1238
    ],
    [
     "2026-01-05",
     3161
    ],
    [
     "2026-01-12",
     3178
    ],
    [
     "2026-01-19",
     3620
    ],
    [
     "2026-01-26",
     3462
    ],
    [
     "2026-02-02",
     3700
    ],
    [
     "2026-02-09",
     3472
    ],
    [
     "2026-02-16",
     3113
    ],
    [
     "2026-02-23",
     3487
    ],
    [
     "2026-03-02",
     3445
    ],
    [
     "2026-03-09",
     4097
    ],
    [
     "2026-03-16",
     3993
    ],
    [
     "2026-03-23",
     4767
    ],
    [
     "2026-03-30",
     3351
    ],
    [
     "2026-04-06",
     3904
    ],
    [
     "2026-04-13",
     15119
    ],
    [
     "2026-04-20",
     4490
    ],
    [
     "2026-04-27",
     4097
    ],
    [
     "2026-05-04",
     5958
    ],
    [
     "2026-05-11",
     3765
    ],
    [
     "2026-05-18",
     4182
    ],
    [
     "2026-05-25",
     3485
    ],
    [
     "2026-06-01",
     3801
    ],
    [
     "2026-06-08",
     3160
    ],
    [
     "2026-06-15",
     4323
    ],
    [
     "2026-06-22",
     6692
    ],
    [
     "2026-06-29",
     4335
    ],
    [
     "2026-07-06",
     6078
    ],
    [
     "2026-07-13",
     4612
    ],
    [
     "2026-07-20",
     2910
    ],
    [
     "2026-07-27",
     3277
    ],
    [
     "2026-08-03",
     3371
    ],
    [
     "2026-08-10",
     3445
    ],
    [
     "2026-08-17",
     4187
    ],
    [
     "2026-08-24",
     4400
    ],
    [
     "2026-08-31",
     4449
    ],
    [
     "2026-09-07",
     2560
    ],
    [
     "2026-09-14",
     3489
    ],
    [
     "2026-09-21",
     4497
    ],
    [
     "2026-09-28",
     4605
    ],
    [
     "2026-10-05",
     4381
    ],
    [
     "2026-10-12",
     3500
    ],
    [
     "2026-10-19",
     5590
    ],
    [
     "2026-10-26",
     9032
    ],
    [
     "2026-11-02",
     7606
    ],
    [
     "2026-11-09",
     8514
    ]
   ],
   "stars": [
    [
     "2026-11-07",
     6087
    ],
    [
     "2026-11-08",
     6087
    ],
    [
     "2026-11-09",
     6087
    ],
    [
     "2026-11-10",
     6088
    ],
    [
     "2026-11-11",
     6089
    ],
    [
     "2026-11-12",
     6089
    ],
    [
     "2026-11-13",
     6088
    ],
    [
     "2026-11-14",
     6089
    ],
    [
     "2026-11-15",
     6089
    ],
    [
     "2026-11-16",
     6089
    ],
    [
     "2026-11-17",
     6089
    ]
   ]
  },
  "stars_flat_since": null,
  "updated_at": "2026-11-17"
 },
 "alternatives": [
  {
   "slug": "textures-js",
   "name": "Textures.js",
   "why": null,
   "current": true,
   "price": "Free",
   "commercial": {
    "value": "Commercial OK",
    "status": "yes"
   },
   "access": "npm"
  },
  {
   "slug": "hero-patterns",
   "name": "Hero Patterns",
   "why": "Pick Hero Patterns when you want ready repeating background tiles for page sections, copied as CSS with your color, not fills inside a chart.",
   "current": false,
   "price": "Free",
   "commercial": {
    "value": "Commercial OK",
    "status": "yes"
   },
   "access": "Download"
  },
  {
   "slug": "pattern-craft",
   "name": "Pattern Craft",
   "why": "Pick Pattern Craft for copy-paste CSS or Tailwind background patterns and gradients without D3 or any script.",
   "current": false,
   "price": "Free",
   "commercial": {
    "value": "Commercial OK",
    "status": "yes"
   },
   "access": "Download"
  },
  {
   "slug": "pattern-monster",
   "name": "Pattern Monster",
   "why": "Pick Pattern Monster when you want to tune a seamless pattern in a web editor and download it as an SVG or PNG file.",
   "current": false,
   "price": "Free tier",
   "commercial": {
    "value": "Commercial OK",
    "status": "yes"
   },
   "access": "MCP, API"
  },
  {
   "slug": "react-bits",
   "name": "React Bits",
   "why": "Animated React components, text effects and backgrounds in JS/TS with CSS or Tailwind; install the source with the shadcn CLI or jsrepo.",
   "current": false,
   "price": "Free tier",
   "commercial": {
    "value": "Commercial OK",
    "status": "yes"
   },
   "access": "Download"
  },
  {
   "slug": "paper-shaders",
   "name": "Paper Shaders",
   "why": "Zero-dependency WebGL shader components: mesh gradients, grain, dithering, liquid metal, god rays, halftone, fluted glass; React or vanilla JS.",
   "current": false,
   "price": "Free",
   "commercial": {
    "value": "Commercial OK",
    "status": "yes"
   },
   "access": "npm"
  }
 ],
 "faq": [
  {
   "q": "Do I need D3?",
   "a": "Yes. The library is built on top of D3 and adds its patterns through a D3 selection; the small d3-selection part is enough."
  },
  {
   "q": "What kinds of patterns are there?",
   "a": "Three families, lines, circles and paths (hexagons, crosses, caps, woven, waves, nylon, squares), plus your own path shape."
  },
  {
   "q": "Can I change colors and thickness?",
   "a": "Yes. Each texture has settings such as size, strokeWidth, stroke, fill, background and orientation, and heavier, lighter, thicker and thinner."
  },
  {
   "q": "Can I use it in a paid product?",
   "a": "Yes. It is MIT licensed; keep the license notice with copies of the code."
  }
 ],
 "at_a_glance": {
  "latest_version": "1.2.3",
  "last_release": "2021-04-17",
  "last_commit": "2023-01-01",
  "runtime": "D3 or d3-selection on the page (not a package dependency; our demo used d3-selection 3.0.0); a browser with SVG.",
  "key_needed": false,
  "formats": "js, svg"
 },
 "good_to_know": [
  "The last release, 1.2.3, came out in April 2021. It still works with today's D3, but expect no new features or fixes.",
  "It draws with D3. Without D3 or its small selection part on the page, the patterns are not added.",
  "The patterns are SVG drawings, so they only fill SVG shapes. Charts drawn on a canvas, like most Chart.js charts, cannot use them.",
  "Everything runs in your page. No account, key or outside service is needed."
 ],
 "stack_snippets": [],
 "claims": [],
 "checked": {
  "license_read": "2026-11-09",
  "overview_checked": "2026-11-09",
  "numbers_updated": "2026-11-17",
  "sources": [
   {
    "label": "github.com/riccardoscalco/textures",
    "url": "https://github.com/riccardoscalco/textures"
   },
   {
    "label": "README on GitHub",
    "url": "https://github.com/riccardoscalco/textures/blob/HEAD/README.md"
   },
   {
    "label": "LICENSE on GitHub",
    "url": "https://github.com/riccardoscalco/textures/blob/HEAD/license"
   },
   {
    "label": "github.com/riccardoscalco/textures/blob/HEAD/src/random.js",
    "url": "https://github.com/riccardoscalco/textures/blob/HEAD/src/random.js"
   },
   {
    "label": "github.com/riccardoscalco/textures/blob/HEAD/src/lines.js",
    "url": "https://github.com/riccardoscalco/textures/blob/HEAD/src/lines.js"
   },
   {
    "label": "riccardoscalco.it/textures",
    "url": "https://riccardoscalco.it/textures/"
   },
   {
    "label": "npm: textures",
    "url": "https://registry.npmjs.org/textures"
   }
  ],
  "unverified": null
 },
 "user_reports": null,
 "url": "https://agentgid.com/assets/textures-js/",
 "note": "Written by AgentGid from the official pages in checked.sources; quotes are copied from those pages. status: yes | cond | no | unknown | info. Prices and vendor claims are as reported on the checked date. Not legal advice."
}
