online-status-svg
v0.1.1
Published
Generate SVGs with an online status indicator.
Downloads
22
Maintainers
Readme
online-status-svg
Generate SVGs with an online status badge.
Examples
No background:
Circular background with 1px backgroundStrokeWidth:
Rectangular background with 0px backgroundStrokeWidth:
Usage
To use the npm package in your project run:
npm install online-status-svgTo generate an svg string:
import { OnlineStatusSvg } from 'online-status-svg';
const status = new OnlineStatusSvg({
textColor: "#eeeeee",
dotColor: "#00ff00",
statusText: "ONLINE",
});
const svg = status.render();Available parameters:
| Option | Type | Default |
| ----------------------- | --------------------------------------- | ----------- |
| statusText | string | "OFFLINE" |
| dotColor | ColorString | "#ff0000" |
| dotStrokeColor | ColorString | "#333333" |
| dotStrokeWidth | number | 1 |
| textSpacing | number | 1.05 |
| textColor | ColorString | "#eeeeee" |
| textFontWeight | "bold" \| "normal" | "bold" |
| backgroundColor | ColorString | "#222222" |
| backgroundStrokeColor | ColorString | "#333333" |
| backgroundStrokeWidth | number | 1 |
| backgroundStyle | "none" \| "rectangular" \| "circular" | "none" |
Building
Clone the repository, then run:
npm installNow you can build it using tsc:
npm run buildRunning tests
To run the tests using jest:
npm run testContributing
Contributions of all kinds are welcome. These could be suggestions, issues, bug fixes, documentation improvements, or new features.
For more details see the contribution guidelines.
License
This project is licensed under the MIT license.
