# node-svg-fill

> NodeJS package to fill (part of) an SVG image in a given colour.

Latest version **1.0.2** (published 2022-05-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-svg-fill
pnpm add node-svg-fill
yarn add node-svg-fill
bun add node-svg-fill
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-05-22 |
| First published | 2022-05-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=14 |
| Dependencies | 1 |
| Unpacked size | 30.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Pieter De Clercq |
| Maintainers | thepieterdc |
| Keywords | colour, fill, gradient, svg |

## Links

- npm: https://www.npmjs.com/package/node-svg-fill
- Repository: https://github.com/thepieterdc/node-svg-fill
- npm.io page: https://npm.io/package/node-svg-fill

## Dependencies (1)

- [svgson](https://npm.io/package/svgson.md) ^5.2.1

## Alternatives

- [postcss-color-hex-alpha](https://npm.io/package/postcss-color-hex-alpha.md) — 6.4M weekly downloads
- [randomcolor](https://npm.io/package/randomcolor.md) — 348.0K weekly downloads
- [bows](https://npm.io/package/bows.md) — 1.3K weekly downloads
- [ep_prefer_color_scheme](https://npm.io/package/ep_prefer_color_scheme.md) — 260 weekly downloads
- [coc-yank](https://npm.io/package/coc-yank.md) — 61 weekly downloads

## Recent versions

- 1.0.2 (latest) — 2022-05-22
- 1.0.1 — 2022-05-20
- 1.0.0 — 2022-05-20

## README

# node-svg-fill

![https://www.npmjs.com/package/node-svg-fill](https://img.shields.io/npm/v/node-svg-fill?style=flat-square)
[![codecov](https://codecov.io/gh/thepieterdc/node-svg-fill/branch/master/graph/badge.svg?token=THusEk1EON)](https://codecov.io/gh/thepieterdc/node-svg-fill)

NodeJS package to fill (part of) an SVG image in a given colour.

## Installation

The package can be installed via your favourite `node` package manager:

```
yarn add node-svg-fill
```

## Examples

### Example: Fill a circle completely in yellow

**Input:**

![examples/full/input.svg](examples/fill/input.svg)

**Code:**

```js
const svgFill = require("node-svg-fill");
console.log(svgFill.fill(input, "#FFFF00"));
```

**Output:**

![examples/full/output.svg](examples/fill/output.svg)

### Example: Fill letters in two directions with a gradient

**Input:**

![examples/gradient/input-a.svg](examples/gradient/input-a.svg)
![examples/gradient/input-m.svg](examples/gradient/input-m.svg)

**Code:**

```js
const svgFill = require("node-svg-fill");
console.log(svgFill.fillGradient(inputA, [{
    "color": "#FF0000",
    "from": 0,
    "to": 0.20,
}, {
    "color": "#0000FF",
    "from": 0.70,
    "to": 1,
}]));
console.log(svgFill.fillGradient(inputM, [{
    "color": "#FF00FF",
    "from": 0,
    "to": 0.50,
}, {
    "color": "#A0F0F0",
    "from": 0.50,
    "to": 1,
}], 90));
```

![examples/gradient/output-a.svg](examples/gradient/output-a.svg)
![examples/gradient/output-m.svg](examples/gradient/output-m.svg)

---
_Source: https://npm.io/package/node-svg-fill · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
