research-cli
Version:
AI-powered research assistant with web search capabilities and beautiful terminal UI
126 lines • 4.19 kB
JavaScript
/**
* Chalk-based styling system for research-cli
* Provides semantic styling themes and brand colors for consistent terminal output
*/
import chalk, { Chalk } from "chalk";
// Brand color palette - professional blues and grays with semantic colors
export const colors = {
// Primary brand colors
brand: {
primary: "#2563EB", // Professional blue
secondary: "#1E40AF", // Darker blue
accent: "#3B82F6", // Lighter blue
},
// Semantic colors for messages
semantic: {
success: "#10B981", // Green
warning: "#F59E0B", // Amber
error: "#EF4444", // Red
info: "#3B82F6", // Blue
muted: "#6B7280", // Gray
},
// System colors
system: {
text: "#111827", // Dark gray for text
textLight: "#6B7280", // Light gray for secondary text
background: "#F9FAFB", // Light background
border: "#E5E7EB", // Border gray
},
};
// Core theme instances using chalk
export const styles = {
// Brand styling
brand: {
primary: chalk.hex(colors.brand.primary),
secondary: chalk.hex(colors.brand.secondary),
accent: chalk.hex(colors.brand.accent),
},
// Semantic message styles
success: chalk.hex(colors.semantic.success).bold,
warning: chalk.hex(colors.semantic.warning).bold,
error: chalk.hex(colors.semantic.error).bold,
info: chalk.hex(colors.semantic.info),
muted: chalk.hex(colors.semantic.muted),
// Text hierarchy
heading: chalk.hex(colors.brand.primary).bold,
subheading: chalk.hex(colors.brand.secondary),
body: chalk.hex(colors.system.text),
secondary: chalk.hex(colors.system.textLight),
// Interactive elements
link: chalk.hex(colors.brand.accent).underline,
button: chalk.hex(colors.brand.primary).inverse,
highlight: chalk.hex(colors.brand.accent).bgHex("#F1F5F9"),
// Status indicators
checkmark: chalk.hex(colors.semantic.success),
cross: chalk.hex(colors.semantic.error),
warning_icon: chalk.hex(colors.semantic.warning),
info_icon: chalk.hex(colors.semantic.info),
// Code and technical content
code: chalk.hex("#374151").bgHex("#F3F4F6"),
command: chalk.hex(colors.brand.primary).bold,
path: chalk.hex(colors.semantic.info),
// Emphasis
bold: chalk.bold,
italic: chalk.italic,
underline: chalk.underline,
dim: chalk.dim,
};
// Icon constants with emoji fallbacks
export const icons = {
success: "✅",
error: "❌",
warning: "⚠️",
info: "ℹ️",
loading: "🔄",
search: "🔍",
key: "🔑",
tool: "🔧",
stats: "📊",
config: "⚙️",
book: "📖",
gear: "🔧",
checkmark: "✓",
cross: "✗",
arrow: "→",
bullet: "•",
};
// Utility functions for creating custom themes
export function createTheme(options) {
const chalkOptions = {};
if (options.level !== undefined) {
chalkOptions.level = options.level;
}
if (options.stderr) {
chalkOptions.stream = process.stderr;
}
const chalk_instance = new Chalk(chalkOptions);
return {
success: chalk_instance.hex(colors.semantic.success).bold,
warning: chalk_instance.hex(colors.semantic.warning).bold,
error: chalk_instance.hex(colors.semantic.error).bold,
info: chalk_instance.hex(colors.semantic.info),
muted: chalk_instance.hex(colors.semantic.muted),
brand: chalk_instance.hex(colors.brand.primary),
};
}
// Special themes for different contexts
export const themes = {
// Standard output theme
stdout: createTheme({ level: 3 }),
// Error output theme (for stderr)
stderr: createTheme({ level: 3, stderr: true }),
// Monochrome theme for automation/piped output
monochrome: createTheme({ level: 0 }),
// High contrast theme
highContrast: {
success: chalk.green.bold,
warning: chalk.yellow.bold,
error: chalk.red.bold,
info: chalk.blue.bold,
muted: chalk.gray,
brand: chalk.cyan.bold,
},
};
// Export the default theme for backward compatibility
export default styles;
//# sourceMappingURL=styles.js.map