npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

orange-svg

v0.1.1

Published

Orange.SVG - library for working with colors

Readme

Orange.SVG

Library for generating SVG as DOM elements or string.

This library has limited functionality (mostly because it was created to be used by another library which doesn't use all SVG elements), but you can extend it in your projects.

You can build this library for static front-end usage via command npm run build (you need to run npm install first). JavaScript file will appear in the dist directory.

Classes

OrangeSVG

Class represents SVG document.

| Element | Name | Type | Description | |---|---|---|---| | method | constructor | | Creates SVG object | | property | w | number | Width | | property | h | number | Height | | property | x1 | number | X coordinate of top left corner | | property | y1 | number | Y coordinate of top left corner | | method | appendChild | OrangeSVG | Adds element into SVG document | | render | render | SVGSVGElement | Renders SVG in the container (can be defined by element's ID of DOM Element itself) | | property | element | SVGSVGElement | SVG Object converted to HTML SVGSVGElement | | property | toString | string | SVG Object converted to HTML string |

OrangeSVGAbstractElement

This is parental class for all SVG Elements in this library. All classes below are extended from this class and have its methods.

| Element | Name | Type | Description | |---|---|---|---| | abstract property | tag | string | Tag name | | property | args | Object | Custom HTML attributes | | method | toString | string | SVG Element converted to HTML string | | method | createDOMElement | SVGElement* | SVG Element converted to HTML string |

* - can be any SVG-related class like SVGCircleElement, SVGClipPathElement, SVGComponentTransferFunctionElement, etc.

Elements classes

Classes extending OrangeSVGAbstractElement have different constructors.

| Class | Constructor arguments | |---|---| | OrangeSVGCircle | center_x, center_y, radius, color (optional) | | OrangeSVGLine | start_x, start_y, end_x, end_y, color (optional), thickness (optional) | | OrangeSVGPath | d*, color (optional) | | OrangeSVGPolygon | coordinates, color (optional), opacity (optional) | | OrangeSVGPolyline | coordinates, color (optional), thickness (optional) | | OrangeSVGRect | top_left_x, top_left_y, width, height, color (optional) | | OrangeSVGText | text, x, y, position (optional) |

Example

<html>
<script src="./../dist/orange-svg.min.js"></script>
<body>
<div id="svg-container"></div>
<script>
  const svg = new OrangeSVG(1000, 600, -500, -300)
  svg.appendChild(new OrangeSVGCircle(0, 0, 200, 'orange'))
  svg.appendChild(new OrangeSVGText("Click me", 250, 0), {'click': (e,v) => alert('Library: ' + v.name)}, {"name": "Orange.IP"})
  svg.render('svg-container')
</script>
</body>
</html>

Element svg-container will have value:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="-500 -300 1000 600" width="1000" height="600">
    <circle r="200" cx="0" cy="0" fill="orange"></circle>
    <text x="250" y="0" text-anchor="middle">Click me</text>
</svg>

Text element will have function (e,v) => alert('Library: ' + v.name) to be assigned to click event and object {"name": "Orange.IP"} to be passed there as the second argument.