svg-highlight

1.0.2 • Public • Published

svg-highlight

Build Version Size Issues Licence

A tiny js tool to highlight an SVG element, that acts like a z-index: +1.

Why ?
Since SVG uses the order of DOM elements during the drawing stage, those at the same level overlap. It can be used i.e. to show complete stroke of an highlighted element.

⚙️ Installation

Using npm :

npm install svg-highlight

Using yarn :

yarn add svg-highlight

Usage

import svgHighlight from "svg-highlight";

const yourSvgElement = document.querySelector('.your-svg-element');
svgHighlight(yourSvgElement);

Options

You can pass some options for advanced usage :

svgHighlight(yourSvgElement, {
    // The class you want to use one the highlighted element.
    // (default: 'svg-highlight')
    customClass: 'my-highlighted-class'
})

👨‍💻 Credits

© Robin Simonklein

Package Sidebar

Install

npm i svg-highlight

Weekly Downloads

2

Version

1.0.2

License

ISC

Unpacked Size

5.58 kB

Total Files

7

Last publish

Collaborators

  • rsimonklein