Figlet Generator

approvedunreviewed

by saltyfireball

Generate and display ASCII art text using Figlet fonts. Supports 326 bundled fonts, gradient colors, code blocks, and a cross-plugin API.

★ 1 stars↓ 52 downloadsUpdated 8d agoMIT

Figlet Generator

OAuth DNS Profile Song Secret Menu Framework Wallpaper Cursor Theme Sock Drawer Free Trial

Generate and display ASCII art text using Figlet fonts in Obsidian: 326 bundled fonts, solid colors, gradients, and sizing options, from a code block or an insert dialog.

Author: saltyfireball

Rainbow FIGLET title in ANSI Shadow above a smaller blue subtitle

Features

Code blocks that render as ASCII art

Write options on top, a --- line, then your text. The block re-renders as you edit it.

```sfb-figlet
font: Big
color: rainbow
---
Hi there
```

Editing a code block: the font, color and text change and the art updates

326 fonts

Every font from the Figlet font library ships inside the plugin, so nothing extra needs installing. Font names ignore case: font: ansi shadow works.

A grid of twelve fonts: Standard, Big, Slant, ANSI Shadow, Doom, Banner3, Small, Graffiti, Larry 3D, Isometric1, Ogre, Bloody

Solid colors, gradients and rainbow

One color, a list of colors for a gradient, or rainbow for the palette in settings.

Code blocks next to their output: a solid blue word, a red-yellow-green gradient, and a rainbow

```sfb-figlet
font: Big
colors: #FF0000 #FFFF00 #00FF00
---
Gradient
```

Size, opacity and alignment

Code blocks showing font-size, opacity, centered: false, and two lines with and without multi-center

multi-center: true centers each line on its own; without it the lines keep their left edges and the block is centered as a whole.

Insert dialog

Run Insert figlet ASCII art from the command palette to type text, pick a color and font, watch the preview, and insert either an sfb-figlet code block or plain HTML.

The insert dialog: typing Notes, setting rainbow, and switching fonts with the preview updating

Light themes

Colors come from your code block; everything else follows the theme.

A gradient Roadmap title in a light-theme note

Cross-plugin API

Other plugins can generate ASCII art through window.figletAPI.

const ascii = await window.figletAPI.generateText('Hello', 'Banner');
const html = window.figletAPI.createHtml(ascii, { color: '#FF0000' });

Installation

Obsidian Community Plugin (pending)

This plugin has been submitted for review to the Obsidian community plugin directory. Once approved, you will be able to install it directly from Settings > Community plugins > Browse by searching for "Figlet Generator".

Using BRAT

You can install this plugin right now using the BRAT plugin:

  1. Install BRAT from Settings > Community plugins > Browse (search for "BRAT" by TfTHacker)

  2. Open the BRAT settings

  3. Under the Beta plugins section, click Add beta plugin

    BRAT beta plugin list

  4. In the overlay, enter this plugin's repository: https://github.com/saltyfireball/obsidian-figlet-generator (or just saltyfireball/obsidian-figlet-generator)

    BRAT add beta plugin

  5. Leave the version set to latest

    BRAT beta plugin filled

  6. Click Add plugin

Manual

  1. Download the latest release from the Releases page
  2. Copy main.js, manifest.json, and styles.css into your vault's .obsidian/plugins/figlet-generator/ directory
  3. Enable the plugin in Settings > Community plugins

Usage

Insert dialog

  1. Open the command palette (Ctrl/Cmd + P)
  2. Search for "Insert figlet ASCII art"
  3. Enter your text
  4. Optionally set a color (hex, CSS name, or rainbow) and pick a font
  5. Choose Code block or HTML output
  6. Click Insert

Code blocks

Create a code block with language ID sfb-figlet (configurable in settings). Options go above the --- line, text below it:

```sfb-figlet
font: Big
color: #FF6B6B
font-size: 12
line-height: 1.2
centered: true
opacity: 0.8
---
Your Text Here
```

Code block options

OptionTypeDefaultDescription
fontstringStandardName of the Figlet font to use (case does not matter)
colorstringinheritA single color, several space/comma-separated colors, or rainbow/gradient for the palette in settings
colorsstring-Same as color; the two are interchangeable
font-sizenumbersettings value (10)Font size in pixels
line-heightnumbersettings value (1)Line height multiplier
centeredbooleansettings value (true)Center the output
opacitynumber1Opacity from 0 to 1 (figlet-opacity is an alias)
multi-centerbooleanfalseCenter each line independently
load_textstring-frontmatter fills {{frontmatter:key}} placeholders in the text from the note's frontmatter

With load_text: frontmatter, each {{frontmatter:key}} in the text is replaced by that frontmatter value of the note (a string, number or boolean; anything else, or a missing key, becomes empty):

```sfb-figlet
font: Big
load_text: frontmatter
---
{{frontmatter:title}}
```

color and colors accept the same values:

ExampleResult
color: #5C7CFASingle color
color: #FF0000 #FFFF00 #00FF003-color gradient
color: rainbow or color: gradientPalette from settings

Gradients blend smoothly between hex and rgb()/rgba() stops, with channels as numbers (rgb(255, 0, 0)) or percentages (rgb(100%, 0%, 0%)), comma or space separated (rgb(255 0 0 / 50%)). Negative, out-of-range and exponent values (rgb(-10 0 2.55e2)) clamp to 0-255, and the space form takes none for 0. A malformed rgb() stop, including one that mixes numbers and percentages, renders as transparent. With any other stop (a named color, a CSS variable, hsl()), each part of the text takes its nearest stop instead, in bands.

Examples

```sfb-figlet
font: Banner
color: #5C7CFA
---
My Notes
```
```sfb-figlet
font: Lean
color: #4CAF50
font-size: 11
---
Introduction
```
```sfb-figlet
font: Slant
color: #FF6188 #FC9867 #FFD866 #A9DC76 #78DCE8
---
Inline Multi-Color
```
```sfb-figlet
font: Standard
multi-center: true
---
Centered
Lines
```

Cross-plugin API

generateText(text: string, font?: string): Promise<string>

Returns the ASCII art as plain text.

const ascii = await window.figletAPI.generateText('Hello', 'Banner');

createHtml(figletText: string, options?: FigletStyleOptions): string

Wraps ASCII art from generateText in styled HTML. The font is chosen in generateText; createHtml only styles it. Unlike code blocks, it does not read the plugin's settings: options left out use the fixed defaults (font size 10, line height 1, centered).

const ascii = await window.figletAPI.generateText("Hello", "Standard");
const html = window.figletAPI.createHtml(ascii, {
    color: "#FF0000",
    fontSize: 12,
    lineHeight: 1.2,
    centered: true,
    opacity: 0.8,
});

defaultGradientColors

The plugin's default gradient palette.

console.log(window.figletAPI.defaultGradientColors);
// ['#FF6188', '#FC9867', '#FFD866', '#A9DC76', '#78DCE8', '#5C7CFA', '#AB9DF2']

openModal(app: App, plugin: unknown, editor: Editor): void

Opens the insert dialog for an editor, as the Insert figlet ASCII art command does. The dialog inserts at the editor's cursor or replaces its selection. It always uses Figlet Generator's own settings: app and plugin are accepted for compatibility and ignored.

window.figletAPI.openModal(this.app, this, editor);

FigletStyleOptions

interface FigletStyleOptions {
    color?: string;
    colors?: string[]; // two or more for a gradient
    fontSize?: number;
    lineHeight?: number;
    centered?: boolean;
    opacity?: number; // 0 to 1
}

Settings

Requires Obsidian 1.13 or later. Every setting here also shows up in Obsidian's settings search.

The settings tab: code block language ID, font size, line height, center output, and gradient colors

  • Code block language ID - The language identifier for code blocks (default: sfb-figlet; reload the plugin after changing it)
  • Font size - Default font size in pixels (default: 10)
  • Line height - Default line height multiplier (default: 1)
  • Center output - Center output by default (default: on)
  • Gradient colors - The palette for rainbow and gradient
  • Favorite fonts - Fonts listed first in the insert dialog

Troubleshooting

Code block not rendering

  • Check that the language ID matches your settings (default: sfb-figlet)
  • Put your text after the --- line

Font not found

  • Check the spelling against the font list in the insert dialog or settings
  • Use Standard if unsure

API not available

  • Make sure Figlet Generator is installed and enabled
  • Check the developer console for errors

Limitations

  • Very large text may be slow to render
  • Some fonts do not include every character

About the font data in main.js

Most of main.js (about 1.5 MB) is font data, not code. At build time, scripts/figlet-fonts-plugin.mjs reads each font listed in src/font-list.json from the figlet package's fonts/ folder, gzips it and embeds it as a base64 string, because the community directory installs only main.js, manifest.json and styles.css. Each string decodes back to the original .flf text file when a font is first used, and the tests check that every one matches its source file byte for byte. Nothing in it is executable code.

Making the README media

The screenshots and GIFs in assets/media/ are captured from the Obsidian app with the plugin installed, by the author's obsidian-plugin-showcase tool (a separate, private repository, not part of this plugin). Build this plugin first (npm run build) in a checkout next to the showcase checkout, then run node src/run.mjs plugins/figlet/scenes.mjs from the showcase checkout and copy its output into assets/media/.

License

MIT

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.