Isomorphic Lolcat is a versatile library designed for rendering colorful gradient text. Whether working in Node.js or the browser, this tool allows developers to bring a lively touch to their text output, making it visually appealing and fun to use.
Isomorphic Lolcat is a lightweight library inspired by lolcatjs that enables developers to create vibrant gradient text in both Node.js and browser environments. This tool effortlessly incorporates rainbow-colored ASCII art into applications, enhancing visual appeal with colorful text output.

Features
- Render gradient text in various environments.
- Easy-to-use API for customizing character colors.
Quick Demo
Check out the live Demo.
Usage Examples
To get started, simply include the library in your Node.js or browser project:
Node.js:
const lolcat = require('isomorphic-lolcat');
Browser:
<script src="https://cdn.jsdelivr.net/npm/isomorphic-lolcat"></script>
API Overview
The library offers two main functions for formatting text:
-
lolcat.format
A customizable low-level function that accepts a callback to handle each character.const styles = []; let i = 20; const o = rand(256); function eachLine() { i -= 1; lolcat.options.seed = o + i; } function rand(max) { return Math.floor(Math.random() * (max + 1)); } console.log(lolcat.format(function(char, color) { styles.push(`color: ${hex(color)}; background: black`); return `%c${char}`; }, 'Lorem Ipsum Dolor Sit Amet', eachLine), ...styles); -
lolcat.rainbow
A streamlined function that utilizes default parameters for a quick gradient effect.const styles = []; function format(char, color) { styles.push(`color: ${hex(color)}; background: black`); return `%c${char}`; } console.log(lolcat.rainbow(format, 'Lorem Ipsum Dolor Sit Amet').join('\n'), ...styles);
Options
Customize the behavior of the gradient with the following options:
options: {
seed: 0, // Determines the pattern
spread: 8.0, // Color spread
freq: 0.3, // Frequency of rainbow colors
}
Isomorphic Lolcat simplifies the process of adding colorful text to applications, making it an excellent choice for developers looking to inject some creativity into their work.
No comments yet.
Sign in to be the first to comment.