#!/usr/bin/env node /** * Custom theming example * * This example demonstrates how to use custom themes with cli-html * to control the appearance of rendered HTML and Markdown. */ import { renderHTML, renderMarkdown } from '../../index.js'; // Define custom themes const darkTheme = { h1: 'magenta bold', h2: 'cyan bold', h3: 'blue bold', a: 'cyan underline', blockquote: 'gray italic', code: { color: 'yellowBright', inline: 'bgBlack yellow', numbers: 'blackBright dim' }, table: { header: 'magenta bold', caption: 'bold cyan', cell: 'white' }, ul: { color: 'green', markers: [ { marker: '◆', color: 'green' }, { marker: '■', color: 'greenBright' }, { marker: '▸', color: 'cyan' } ] }, ol: { color: 'blueBright', markers: [ { marker: '1', color: 'blueBright' }, { marker: 'A', color: 'cyanBright' }, { marker: 'a', color: 'magentaBright' }, { marker: 'I', color: 'greenBright' }, { marker: 'i', color: 'yellowBright' } ] } }; const lightTheme = { h1: 'blue bold', h2: 'green bold', h3: 'yellow bold', a: 'blue underline', blockquote: 'blackBright italic', code: { color: 'blue', inline: 'bgWhite black', numbers: 'gray dim' }, table: { header: 'blue bold', caption: 'bold green', cell: 'black' } }; const vibrantTheme = { h1: 'redBright bold', h2: 'yellowBright bold', h3: 'greenBright bold', a: 'cyanBright underline', blockquote: 'magentaBright italic', code: { color: 'greenBright', inline: 'bgBlack greenBright', numbers: 'gray' }, table: { header: 'redBright bold', caption: 'bold yellowBright', cell: 'whiteBright' }, ul: { color: 'cyanBright', markers: [ { marker: '★', color: 'yellowBright' }, { marker: '✦', color: 'cyanBright' }, { marker: '✧', color: 'magentaBright' } ] } }; // Example content const htmlContent = `
This is a paragraph with bold text and inline code.
const theme = {
h1: "magenta bold",
code: { color: "yellowBright" }
};
| Feature | Status |
|---|---|
| Theming | ✓ Supported |
| Colors | ✓ Full support |