UNPKG

faf-cli

Version:

😽 TURBO-CAT: The Rapid Catalytic Converter • Project DNA ✨ for ANY AI • Fully Integrated with React, Next.js, Svelte, TypeScript, Vite & n8n • FREE FOREVER • 10,000+ developers • Championship Edition

111 lines 3.66 kB
"use strict"; /** * 🎨 Color Accessibility Utilities * Provides colorblind-friendly and no-color support */ Object.defineProperty(exports, "__esModule", { value: true }); exports.colors = void 0; exports.setColorOptions = setColorOptions; exports.getScoreColor = getScoreColor; exports.getScoreEmoji = getScoreEmoji; const colors_1 = require("../fix-once/colors"); // Global color settings let globalColorEnabled = true; let globalColorScheme = 'normal'; function setColorOptions(enabled, scheme = 'normal') { globalColorEnabled = enabled; globalColorScheme = scheme; // Disable chalk globally if no-color is requested if (!enabled) { colors_1.chalk.level = 0; } } // Score-specific colors that work across all color schemes function getScoreColor(percentage) { if (!globalColorEnabled) { return (text) => text; } // Color schemes optimized for different types of colorblindness switch (globalColorScheme) { case 'deuteranopia': // Red-green colorblind (most common) if (percentage >= 90) { return colors_1.chalk.blue; } if (percentage >= 70) { return colors_1.chalk.yellow; } return colors_1.chalk.magenta; case 'protanopia': // Red colorblind if (percentage >= 90) { return colors_1.chalk.blue; } if (percentage >= 70) { return colors_1.chalk.yellow; } return colors_1.chalk.cyan; case 'tritanopia': // Blue-yellow colorblind (rare) if (percentage >= 90) { return colors_1.chalk.green; } if (percentage >= 70) { return colors_1.chalk.magenta; } return colors_1.chalk.red; case 'normal': default: if (percentage >= 90) { return colors_1.chalk.green; } if (percentage >= 70) { return colors_1.chalk.yellow; } return colors_1.chalk.red; } } // Championship Medal System function getScoreEmoji(percentage, useEmoji = true) { if (!globalColorEnabled || !useEmoji) { if (percentage >= 100) { return '[TROPHY]'; } if (percentage >= 99) { return '[GOLD]'; } if (percentage >= 95) { return '[SILVER]'; } if (percentage >= 85) { return '[BRONZE]'; } return '[IN_PROGRESS]'; } if (percentage >= 100) { return '🏆'; } // Trophy - 100% with 50|50 balance if (percentage >= 99) { return '🥇'; } // Gold - 99% if (percentage >= 95) { return '🥈'; } // Silver (Target 2) - 95% if (percentage >= 85) { return '🥉'; } // Bronze (Target 1) - 85% if (percentage >= 70) { return '🟢'; } // GO! - Ready for Target 1 if (percentage >= 55) { return '🟡'; } // Getting ready return '🔴'; // Stop - Needs work } // Simplified color utilities exports.colors = { success: (text) => !globalColorEnabled ? text : colors_1.chalk.green(text), warning: (text) => !globalColorEnabled ? text : colors_1.chalk.yellow(text), error: (text) => !globalColorEnabled ? text : colors_1.chalk.red(text), info: (text) => !globalColorEnabled ? text : colors_1.chalk.cyan(text), highlight: (text) => !globalColorEnabled ? text : colors_1.chalk.blue(text), dim: (text) => !globalColorEnabled ? text : colors_1.chalk.gray(text), }; //# sourceMappingURL=color-utils.js.map