1.0.3 โ€ข Published 2 years ago

variant.js v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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.

VariantAliasDescriptionExample
monospacemMonospace๐š–๐š˜๐š—๐š˜๐šœ๐š™๐šŠ๐šŒ๐šŽ
boldbBold text๐›๐จ๐ฅ๐
italicifItalic text๐‘–๐‘ก๐‘Ž๐‘™๐‘–๐‘
bold italicbibold+italic text๐’ƒ๐’๐’๐’… ๐’Š๐’•๐’‚๐’๐’Š๐’„
scriptcHandwriting style๐“ˆ๐’ธ๐“‡๐’พ๐“…๐“‰
bold scriptbcBolder handwriting๐“ซ๐“ธ๐“ต๐“ญ ๐“ผ๐“ฌ๐“ป๐“ฒ๐“น๐“ฝ
gothicgGothic (fraktur)๐”ค๐”ฌ๐”ฑ๐”ฅ๐”ฆ๐” 
gothic boldgbGothic in bold๐–Œ๐–”๐–™๐–๐–Ž๐–ˆ ๐–‡๐–”๐–‘๐–‰
doublestruckdOutlined text๐••๐• ๐•ฆ๐•“๐•๐•–๐•ค๐•ฅ๐•ฃ๐•ฆ๐•”๐•œ
๐—Œ๐–บ๐—‡๐—ŒsSans-serif style๐—Œ๐–บ๐—‡๐—Œ
bold ๐—Œ๐–บ๐—‡๐—ŒbsBold sans-serif๐—ฏ๐—ผ๐—น๐—ฑ ๐˜€๐—ฎ๐—ป๐˜€
italic ๐—Œ๐–บ๐—‡๐—ŒisItalic sans-serif๐˜ช๐˜ต๐˜ข๐˜ญ๐˜ช๐˜ค ๐˜ด๐˜ข๐˜ฏ๐˜ด
bold italic sansbisBold italic sans-serif๐™—๐™ค๐™ก๐™™ ๐™ž๐™ฉ๐™–๐™ก๐™ž๐™˜ ๐™จ๐™–๐™ฃ๐™จ
circledoLetters within circlesโ“’โ“˜โ“กโ“’โ“›โ“”โ““
paranthesispLetters within paranthesisโ’ซโ’œโ’ญโ’ โ’ฉโ’ฏโ’ฃโ’ โ’ฎโ’ค
fullwidthwWider monospace font๏ฝ†๏ฝ•๏ฝŒ๏ฝŒ๏ฝ—๏ฝ‰๏ฝ„๏ฝ”๏ฝˆ

The text can be enriched with underline or strike (or both) through the flags param:

VariantFlagsExample
gothicunderline๐”คฬฒ๐”ฌฬฒ๐”ฑฬฒ๐”ฅฬฒ๐”ฆฬฒ๐” ฬฒ
paranthesisstrike๐š™ฬถ๐šŠฬถ๐š›ฬถ๐šŠฬถ๐š—ฬถ๐šฬถ๐š‘ฬถ๐šŽฬถ๐šœฬถ๐š’ฬถ๐šœฬถ

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.