Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/miraclx/svgembed
SVG embedder for https://github.com/marionebl/svg-term
https://github.com/miraclx/svgembed
asciicast asciinema css embedder font svg svg-term svg-term-cli tty
Last synced: about 1 month ago
JSON representation
SVG embedder for https://github.com/marionebl/svg-term
- Host: GitHub
- URL: https://github.com/miraclx/svgembed
- Owner: miraclx
- License: apache-2.0
- Created: 2020-05-17T18:03:20.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-05-17T20:18:38.000Z (over 4 years ago)
- Last Synced: 2023-10-20T21:50:11.951Z (about 1 year ago)
- Topics: asciicast, asciinema, css, embedder, font, svg, svg-term, svg-term-cli, tty
- Language: JavaScript
- Homepage:
- Size: 791 KB
- Stars: 12
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# svgembed
> SVG embedder for
## Installing
``` bash
npm install -g git+https://github.com/miraclx/svgembed# alternatively, with yarn
yarn global add https://github.com/miraclx/svgembed.git
```## Features
- [x] Window titles
- [x] Embed custom fonts (ttf, otf) **[useful in the case of embedding powerline/nerd fonts]**
- [ ] Multiple font files
- [x] Move icons (close, minimize, maximize) to the right side of the window.
- [x] Window icon darken on hover (doesn't work behind `` tags like on GitHub)
- [ ] Customize window icon order
- [ ] Embed custom CSS
- [ ] Handle filestreams and `stdin`## Caveats
Since this script just embeds the files you give it along with some SVG patches, the filesize is incremental and can be really large in some cases.
Try using lightweight versions of fonts you embed. Or create custom fonts with the glyphs you need.Depending on your browser and internet connection, the fonts might take a little while to load.
## Usage
`$ svgembed --help`
``` text
svgembed (c) 2020 Miraculous Owonubi
------------------------------------------------------------
Usage: svgembed [options]Options
-i, --input the input SVG file
-o, --output the output file name
-f, --font fontfile to be embedded (otf/ttf)
-t, --title [VALUE] set terminal window title (default: "Terminal")
-r, --right use right-sided window icons
-v, --hover dim window icons on hover
--overwrite overwrite existing output
--h, --help output usage information
```## Screenshots
### Original SVG from svg-term
`svg-term --in media/demo --out demo.svg --window --term konsole --width 78`
- Input Size: `52.10 KiB`
- Output Size: `501.62 KiB`![Screenshot of original output from svg-term](media/demo.svg)
### Processed
`svgembed -i demo.svg -o final.svg -r -f nerd_fonts.ttf -t "svgembed is cool" --hover`
- Input Size: `501.62 KiB`
- Font: Fira Code Nerd Font, Regular (`1007.0 KiB`)
- Title: `"svgembed is cool"`
- Icon position: `right`
- On hover: `dim` (view the [raw SVG](https://cdn.jsdelivr.net/gh/miraclx/svgembed/media/final.svg) to see this)
- Output Size: `1844.76 KiB`![Screenshot of embedded fonts](media/final.svg)
### Window icon dim on hover `-v, --hover`
![Screenshot of embedded fonts](media/hover.png)
## Library API
### config: \
- `font`: \: The font to be embedded, if any.
- `title`: \: The window title to be used, if any.
- `right`: \: Whether or not to move window icons to right side.
- `hover`: \: Whether or not to dim window icons on hover.### embedFont
- `file`: \: string representation of the SVG file.
- `config`: \<[config](#config_object)\>### insertTitleAndPositionIcons
- `file`: \: string representation of the SVG file.
- `config`: \<[config](#config_object)\>## License
[Apache 2.0][license] © **Miraculous Owonubi** ([@miraclx][author-url]) <[email protected]>
[license]: LICENSE "Apache 2.0 License"
[author-url]: https://github.com/miraclx