Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 8x 8x 3x 8x 2x 5x 3x 3x 8x 1x 1x 1x 8x 8x 2x 8x 1x 6x 4x 5x 1x 1x 8x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 3x 3x 3x 1x | /**
* Centralized chalk color theme for consistent styling across the application
* Eliminates direct chalk calls and provides semantic color usage
*/
import chalk from "chalk";
import { COLOR_THEME } from "./constants.js";
/**
* Centralized color theme using chalk
*/
export const theme = {
// Primary semantic colors
success: chalk[COLOR_THEME.SUCCESS],
error: chalk[COLOR_THEME.ERROR],
warning: chalk[COLOR_THEME.WARNING],
info: chalk[COLOR_THEME.INFO],
muted: chalk[COLOR_THEME.MUTED],
// File system related
filePath: chalk[COLOR_THEME.FILE_PATH],
fileSize: chalk[COLOR_THEME.FILE_SIZE],
directory: chalk[COLOR_THEME.DIRECTORY],
binaryFile: chalk[COLOR_THEME.BINARY_FILE],
largeFile: chalk[COLOR_THEME.LARGE_FILE] || chalk.yellow,
// Progress indicators
progressSuccess: chalk[COLOR_THEME.PROGRESS_SUCCESS],
progressSkip: chalk[COLOR_THEME.PROGRESS_SKIP],
progressError: chalk[COLOR_THEME.PROGRESS_ERROR],
// Compound styles
highlight: chalk.bold.cyan,
emphasis: chalk.bold,
subtle: chalk.dim,
// Status indicators with emojis
successWithIcon: (text) => chalk.green(`✅ ${text}`),
errorWithIcon: (text) => chalk.red(`❌ ${text}`),
warningWithIcon: (text) => chalk.yellow(`⚠️ ${text}`),
infoWithIcon: (text) => chalk.cyan(`ℹ️ ${text}`),
skipWithIcon: (text) => chalk.yellow(`⏭️ ${text}`),
// File processing specific
fileProcessed: (text) => chalk.green(`✅ ${text}`),
fileSkipped: (text) => chalk.yellow(`⏭️ ${text}`),
fileError: (text) => chalk.red(`❌ ${text}`),
// Headers and sections
sectionHeader: chalk.bold.cyan,
subHeader: chalk.bold.blue,
// Path formatting
relativePath: (path) => chalk.blue(path),
absolutePath: (path) => chalk.cyan(path),
fileName: (name) => chalk.bold.blue(name),
// Size formatting
sizeSmall: chalk.green,
sizeMedium: chalk.yellow,
sizeLarge: chalk.red,
// Generic formatting helpers
bold: chalk.bold,
dim: chalk.dim,
italic: chalk.italic,
underline: chalk.underline
};
/**
* Format file size with appropriate color based on size
*/
export function formatSizeWithColor(sizeBytes, thresholds = {}) {
const { small = 1024 * 1024, large = 10 * 1024 * 1024 } = thresholds; // 1MB, 10MB
if (sizeBytes < small) {
return theme.sizeSmall(formatFileSize(sizeBytes));
} else if (sizeBytes < large) {
return theme.sizeMedium(formatFileSize(sizeBytes));
} else {
return theme.sizeLarge(formatFileSize(sizeBytes));
}
}
/**
* Format file size in human readable format
*/
function formatFileSize(sizeBytes) {
if (sizeBytes < 1024) {
return `${sizeBytes} B`;
} else if (sizeBytes < 1024 * 1024) {
return `${(sizeBytes / 1024).toFixed(1)} KB`;
} else if (sizeBytes < 1024 * 1024 * 1024) {
return `${(sizeBytes / (1024 * 1024)).toFixed(1)} MB`;
} else {
return `${(sizeBytes / (1024 * 1024 * 1024)).toFixed(1)} GB`;
}
}
/**
* Create consistent progress messages
*/
export const progressMessages = {
start: (message) => theme.info(`🔄 ${message}`),
success: (message) => theme.successWithIcon(message),
skip: (message) => theme.skipWithIcon(message),
error: (message) => theme.errorWithIcon(message),
warning: (message) => theme.warningWithIcon(message),
info: (message) => theme.infoWithIcon(message)
};
/**
* Create consistent section headers
*/
export function createSectionHeader(text, level = 1) {
const prefix = level === 1 ? "🚀" : level === 2 ? "📊" : "📋";
return theme.sectionHeader(`\n${prefix} ${text}`);
}
export default theme;
|