https://github.com/metaory/xico
đ§ xico - make images from unicode characters or user custom config
https://github.com/metaory/xico
cli command-line font-glyph font-glyphs icon-gen icon-generation icon-generator svg svg-cli svg-font svg-generator svg-icon svg-icons
Last synced: 3 months ago
JSON representation
đ§ xico - make images from unicode characters or user custom config
- Host: GitHub
- URL: https://github.com/metaory/xico
- Owner: metaory
- License: mit
- Created: 2024-04-03T18:10:01.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-04-13T22:56:45.000Z (about 1 year ago)
- Last Synced: 2024-04-14T12:27:01.873Z (about 1 year ago)
- Topics: cli, command-line, font-glyph, font-glyphs, icon-gen, icon-generation, icon-generator, svg, svg-cli, svg-font, svg-generator, svg-icon, svg-icons
- Language: Shell
- Homepage: https://github.com/metaory/xico
- Size: 32.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
đđęđ
![]()
simple cli to make png images from unicode characters
![]()
@1736000000
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
---
## DESCRIPTION
`xico` is a simple `svg` template.
Rendered with options from command-line or a template file.
It creates `png` images from the `svg`
The `svg` contains only 2 elements
- `` [SVG/Element/rect](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/rect)
- `` [SVG/Element/text](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/text)Most of their attributes [rect attr](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/rect#attributes) and [text attr](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/text#attributes) are added.
Check [Custom Attributes](#custom-attributes) section for adding custom attributes.
## SYNOPSIS
xico [OPTION]... CHR FILE
possible output FILE extension[svg,png,ps,eps,pdf,emf,wmf,xaml]
## Options
### CLI Only Options
These options are only available on CLI
--export-filename Output file name| cli option | alias | default |
| ---------- | ----- | ------- |
| --help | -h | |
| --size | -s | 500 |
| --template | -t | |
| --delay | | 3 |
| --no-delay | | |### Options
These options are available in template and CLI
| option | alias | default |
| -------------------| ----- | ------- |
| delay | d | 3 |
| size | s | 500 |
| background | xbg | black |
| background-opacity | xbo | 0 || rect option | alias | default |
| ------------ | ----- | ------- |
| r_fill | bg | black |
| r_width | w | 100 |
| r_height | h | 100 |
| r_opacity | o | 0.5 |
| r_rx | r | 25 |
| r_ry | r | 25 |
| r_x | | 0 |
| r_y | | 0 || text option | alias | default |
| ------------------ | ------ | -------------- |
| t_fill | fg | #3311FF |
| t_stroke-color | stroke | cyan |
| t_stroke-width | border | 0 |
| t_stroke-linecap | | round |
| t_stroke-linejoin | | round |
| t_font-family | ff | monospace |
| t_font-weight | fw | bold |
| t_font-size | fs | 8em |
| t_rotate | | 0 |
| t_transform | | translate(0,0) |
| t_transform-origin | | center |
| t_dx | | 0 |
| t_dy | | 3.5 |
| t_x | x | 50 |
| t_y | y | 50 |#### CLI Usage
> [!NOTE]
> In command-line
>
> long-options prefixed with double hyphen `--`
> aliases with single hyphen `-`
>
> eg. `t_font-size 9em` or `-fs 9em`eg.
xico --r_fill '#3300FF' Îť
Or alias if available
xico -bg '#3300FF' Ꮏ
### Multi-Form Input
Accept various forms of input, such as stdin, local files & dirs, and remote URLs.
| Input | Example |
| ----------------- | ------------------------------------ |
| CMD input | `xico hello` |
| Stdin pipe | `cat data.txt \| xico` |
| Local files | `xico -f data.txt` |
| Local images | `xico -f image.png` |
| Local directories | `xico -f dir/` |
| Remote URLs | `xico -f https://example.com` |
| Combine Inputs | `xico -f dir/ -f data.txt explain` |#### Template Usage
All options or their alias can be set in a xico template
`set`, `put`, `res` and `pre` are the only commands
> [!NOTE]
> `template` file **name** or **extension** can be anything##### SET command
set
This will set or update the option
`set` commands can be repeated, the latest would take precedence.
# foo.xc
set r_fill #3311FF
set t_font-size 64pxOr alias _if available_
set bg #3311FF
set fs 10emSet commands can be repeated, every set will overwrite the previous value
##### PUT command
`put `
This will create an image from the `` and place it ``
with the current set optionsPut commands can be repeated, every put will use the options set to that point
##### RES command
`res`
Or
`reset`
Will reset all `set` options, any `put` afterwards would use the default options
##### PRE command
`pre `
Any `put` afterwards will output with this prefix.
EG.
```sh
# ...
pre /tmp/fooset bg red
put ă hoge.pngset fg blue
put ă fuga.png# will create
# /tmp/foo/hoge.png
# /tmp/foo/fuga.pngpre $HOME/.config/awesome/layout/
set fg #3311FF
put ⏠tiletop.png
put ⨠tileright.pngset fg #AA44FF
put ⏠tilebottom.png
put â§ tileleft.pngres
put ⏠with_default_option_tilebottom.png
put â§ with_default_option_tileleft.png
```eg. xico -bg red -fg '#3311ff' ó°§ hello.png
#### đĄ Check complete template [templates/default.xc](templates/default.xc)
#### đŁ Check starter template [templates/starter.xc](templates/starter.xc)
## Get Started
```
cp templates/starter.xc
xico -t
```---
> [!CAUTION]
> The final positional arguments is required if no template is provided> [!NOTE]
> The output is always square
>
> Set the output size with `size` or its alias `s`
>
> eg. `size 700` or `s 700`
> would be a square 700x700px png> [!IMPORTANT]
> `size` is integer without any unit, _its always in `px`_> [!NOTE]
> The text is always centered
>
> it can be adjusted with `t_x, t_y, t_dx, t-dy`> [!NOTE]
> The output is always full square on `(0,0)`> [!NOTE]
> the background default radius is `25`
>
> set radius to `50` for a **perfect circle**
> you can set radius with `r` or `r_rx` and `r_ry`> [!CAUTION]
> options with special character need quoting> [!NOTE]
> Options can be used mixed together
> as command-line options or in template> [!IMPORTANT]
> Options can be repeated
> the final one takes precedence.---
### EXAMPLES
# convert one character
xico đş lambda.png# create png from character with rounded cover, custom fg and bg, font size
xico -bg '#112233' -fg '#4411ff' -fs 4em đş ~/pics/x1.png# create a new image from character with custom color, transparent background and default config
xico -fg '#AA1144' ⪠~/pics/x2.png# process a template file
# xico -t awesome-xico.xc---
### Custom Attributes
To add other attributes add an entry To add the `XC` associative array.
Prefix `r_` for `` element and `t_` for `` elementAlmost all [Presentation attributes](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute#presentation_attributes) should work
For `` `[r_]=`
For `` `[t_]=`
eg.
```sh
[t_writing-mode]=vertical-lr[r_stroke-miterlimit]=214
```### The SVG template
Is a simple SVG file placed in [lib/xico.svg](lib/xico.svg) can easily be extended.
---
Requirements
------------- [Inkscape](https://gitlab.com/inkscape/inkscape)
---
Installation
------------- clone repo
- give execution permissions
- place it in your path```ex
# Clone the repo
git clone [email protected]:metaory/xico.git# Navigate to repo
cd xico# Give execution permissions
chmod +x xico# Link it somewhere in your PATH
ln -svf $PWD/xico /usr/bin/xico# Use it anywhere
xico đ° zig.pngxico -bg '#112222'-fg '#AA11FF' -r 50 đş lambda.png
# Usage
xico --help
```TODO
====
- [ ] Dynamic readme usage
- [ ] Dynamic cli usage
- [X] Dynamic attributes
- [X] Reset opts action
- [X] Template
- [x] Attributes; bg, fg, font, size##### Fallback rendering engines
- [.] [ImageMagick](https://www.imagemagick.org) _cairo_
- [.] [libvips](https://github.com/libvips/libvips) _cairo_
- [.] [librsvg](https://wiki.gnome.org/projects/librsvg) _cairo_- [ ] Handle env settings
- [ ] Handle stdin
- [ ] Makefile---
## ENVIRONMENT VARIABLES
# XICO_SILENT | less verbose
# XICO_DEBUG | debug mode## SEE ALSO
inkscape(1)## AUTHOR
metaory , Apr 2024---
âââââââââââââ
âââââââââââââ
ââââââââv0.7â---
## License
[MIT](LICENSE)