Skip to main content
Deno 2 is finally here πŸŽ‰οΈ
Learn more
    ____                                 ______    _              __         __ 
   / __ \  ___    ____   ____           / ____/   (_)   ____ _   / /  ___   / /_
  / / / / / _ \  / __ \ / __ \ ______  / /_      / /   / __ `/  / /  / _ \ / __/
 / /_/ / /  __/ / / / // /_/ //_____/ / __/     / /   / /_/ /  / /  /  __// /_  
/_____/  \___/ /_/ /_/ \____/        /_/       /_/    \__, /  /_/   \___/ \__/  
                                                     /____/                     

nest badge HitCount

Deno-Figlet is a JavaScript/Typescript implementation of a FIGfont driver built and available for Deno πŸ¦• (Soon browser availability).

Figlet is a program for making large letters out of ordinary text.

If you want to know more about how a Figlet font is built, please check out the FIGfont documentation.

Notice: All the fonts in this package are not my property, all credits to their creators (if you want to know who created a font, you can look inside each font).

:computer: Installation

πŸ“₯ Importing

import figlet from 'https://x.nest.land/deno-figlet@0.0.5/mod.js'

πŸ”§ Basic Usage:

Deno-Figlet exports by default the quick method wich runs without specifiying any font or ditctionary preset.

let myAwesomeFiglet = await figlet("Deno is Awesome.")
console.log(myAwesomeFiglet)

It should print:

 ____                            _                                                                     _ 
 |  _ \    ___   _ __     ___    (_)  ___     __ _  __      __   ___   ___    ___    _ __ ___     ___  | |
 | | | |  / _ \ | '_ \   / _ \   | | / __|   / _` | \ \ /\ / /  / _ \ / __|  / _ \  | '_ ` _ \   / _ \ | |
 | |_| | |  __/ | | | | | (_) |  | | \__ \  | (_| |  \ V  V /  |  __/ \__ \ | (_) | | | | | | | |  __/ |_|
 |____/   \___| |_| |_|  \___/   |_| |___/   \__,_|   \_/\_/    \___| |___/  \___/  |_| |_| |_|  \___| (_)

You can also import the methods text and textCB if you want to select the font and/or set a custom dictionary.

import filget, { text, textCB } from 'https://x.nest.land/deno-figlet@0.0.5/mod.js'

let myAwesomeFiglet = await text("Deno is Awesome.","starwars")
console.log(myAwesomeFiglet)

You will get an awesome Star Wars figlet :wink: πŸš€.

For the ones who likes the NodeJS figlet API you can use textCB, wich gets the same results on first param into a callback function:

textCB("Deno is Awesome.", "doom", null, (myAwesomeFiglet) => {
    console.log(myAwesomeFiglet)
})

You will get an awesome Doom Figlet :heart: πŸ”«.

πŸ§ͺ Examples

  • Basic usage:
deno run -A https://deno.land/deno_figlet/examples/starwars.ts
  • Colors (working with another library):
deno run -A https://deno.land/x/deno_figlet/examples/colors.ts

Notice: Colors are provided by the Deno ansi_styles module.

:crown: Contributing

This project is 100% OpenSource, so you can help me with:

  • Bug Report.

  • Ideas and contributing in general

  • If you are brave enough to write/port/add your own font, go ahead and make a PR.

    To make your own fonts quickly and easily, check this awesome FIGlet font editor and say goodbye to the handmade stuff.

    • Once you have your font ready to go:

      • Put the font-file-name.flf into the ./src/fonts/
      • Perform the bundle with deno run -A ./src/scripts/fontBundler.js
      • Check if the bundle is ok at ./dist/fonts/_font_file_name.js
      • Check if type is correctly generated
    • Then commit and make the PR.

✏️ TO DO

  • Chainable text on methods.
  • More than one space. (Done)
  • SyncText method. (Done)
  • Available font list (autocompletion types). (Done)
  • Multiline. (Done)
  • Dictionary Documentation.
  • How to: Make your own dictionary preset.
  • How to: Font usage markup.

πŸ“‹ Changes

  • Now it supports multiline text and multiple spaces for text.

  • Now the deno-figlet module comes with a font bundler to parse all fonts into ESM modules it also generates types for IDE autocompletion. It makes importing and manipulating them a lot easier at production time, but the fonts must still be written in FIGfont format inside the src folder.

  • You can now import the fonts separately to play with them however you want.

    import { _font_name } from 'https://deno.land/deno_figlet/dist/fonts/mod.ts'

    OR

    import font from 'https://deno.land/deno_figlet/dist/fonts/_font_name.ts'

    Note: You don’t need to import fonts manually for using this module, this information is only for developers.

Written By Crawford..

πŸ“œ License

MIT License

Copyright (c) Crawford.

Full license