1.0.3 โข Published 2 years ago
variant.js v1.0.3
variant.js
Install
npm i variant.js
Info
Convert a string into different kind of Unicode variants. Created to show some "cool" styled text in the browsers built-in alert()
, prompt()
and confirm()
dialogs.
Variant | Alias | Description | Example |
---|---|---|---|
monospace | m | Monospace | ๐๐๐๐๐๐๐๐๐ |
bold | b | Bold text | ๐๐จ๐ฅ๐ |
italic | if | Italic text | ๐๐ก๐๐๐๐ |
bold italic | bi | bold+italic text | ๐๐๐๐ ๐๐๐๐๐๐ |
script | c | Handwriting style | ๐๐ธ๐๐พ๐ ๐ |
bold script | bc | Bolder handwriting | ๐ซ๐ธ๐ต๐ญ ๐ผ๐ฌ๐ป๐ฒ๐น๐ฝ |
gothic | g | Gothic (fraktur) | ๐ค๐ฌ๐ฑ๐ฅ๐ฆ๐ |
gothic bold | gb | Gothic in bold | ๐๐๐๐๐๐ ๐๐๐๐ |
doublestruck | d | Outlined text | ๐๐ ๐ฆ๐๐๐๐ค๐ฅ๐ฃ๐ฆ๐๐ |
๐๐บ๐๐ | s | Sans-serif style | ๐๐บ๐๐ |
bold ๐๐บ๐๐ | bs | Bold sans-serif | ๐ฏ๐ผ๐น๐ฑ ๐๐ฎ๐ป๐ |
italic ๐๐บ๐๐ | is | Italic sans-serif | ๐ช๐ต๐ข๐ญ๐ช๐ค ๐ด๐ข๐ฏ๐ด |
bold italic sans | bis | Bold italic sans-serif | ๐๐ค๐ก๐ ๐๐ฉ๐๐ก๐๐ ๐จ๐๐ฃ๐จ |
circled | o | Letters within circles | โโโกโโโโ |
paranthesis | p | Letters within paranthesis | โซโโญโ โฉโฏโฃโ โฎโค |
fullwidth | w | Wider monospace font | ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ |
The text can be enriched with underline or strike (or both) through the flags param:
Variant | Flags | Example |
---|---|---|
gothic | underline | ๐คฬฒ๐ฌฬฒ๐ฑฬฒ๐ฅฬฒ๐ฆฬฒ๐ ฬฒ |
paranthesis | strike | ๐ฬถ๐ฬถ๐ฬถ๐ฬถ๐ฬถ๐ฬถ๐ฬถ๐ฬถ๐ฬถ๐ฬถ๐ฬถ |
Example
const variant = require("variant.js");
console.log(variant.format("Hello World", "monospace", "strike")); // "๐ทฬถ๐ฬถ๐ฬถ๐ฬถ๐ฬถโฬถ๐ฬถ๐ฬถ๐ฬถ๐ฬถ๐ฬถ"
Notes
- There is no support for special chars such as
&
,%
and so on. - Not all combinations of variants and flags is guaranteed to work.
- Some variants does not support numbers some variants does not support capital or small letters.