Formatter class for creating styled terminal output with Codeforces theme. Uses chalk library for coloring with custom hex colors (#1E88E5 blue, #FF6B6B red).
Formatter
import { fmt } from './formatter';fmt.section('📁 CREATE TEMPLATE');fmt.step(1, 'Creating directory');fmt.success('Directory created!');fmt.stepComplete('Done'); Copy
import { fmt } from './formatter';fmt.section('📁 CREATE TEMPLATE');fmt.step(1, 'Creating directory');fmt.success('Directory created!');fmt.stepComplete('Done');
Prints a success message in green.
The message to display
fmt.success('Template created successfully!'); Copy
fmt.success('Template created successfully!');
Prints an error message in red.
The error message to display
fmt.error('Failed to compile validator'); Copy
fmt.error('Failed to compile validator');
Prints a warning message in yellow.
The warning message to display
fmt.warning('testlib.h already exists'); Copy
fmt.warning('testlib.h already exists');
Prints an informational message in white.
The info message to display
fmt.info(`Target: ${generatorName}`); Copy
fmt.info(`Target: ${generatorName}`);
Prints a dimmed/gray log message. Used for less important information.
fmt.log('Additional details...'); Copy
fmt.log('Additional details...');
Returns a green checkmark icon (✓). Use explicitly in messages for better indentation control.
Styled checkmark
fmt.success(`${fmt.checkmark()} Test passed`); Copy
fmt.success(`${fmt.checkmark()} Test passed`);
Returns a red cross icon (✖). Use explicitly in messages for better indentation control.
Styled cross
fmt.error(`${fmt.cross()} Test failed`); Copy
fmt.error(`${fmt.cross()} Test failed`);
Returns a yellow warning icon (⚠). Use explicitly in messages for better indentation control.
Styled warning icon
fmt.warning(`${fmt.warningIcon()} Memory limit not supported on Windows`); Copy
fmt.warning(`${fmt.warningIcon()} Memory limit not supported on Windows`);
Returns a blue info icon (ℹ). Use explicitly in messages for better indentation control.
Styled info icon
fmt.info(`${fmt.infoIcon()} Found 5 generators`); Copy
fmt.info(`${fmt.infoIcon()} Found 5 generators`);
Prints a section header with blue double-line border. Used to separate major sections in command output.
The section title
fmt.section('📁 CREATE NEW PROBLEM TEMPLATE'); Copy
fmt.section('📁 CREATE NEW PROBLEM TEMPLATE');
Prints a numbered step header with a top corner bracket.
The step number
The step description
fmt.step(1, 'Creating Directory Structure'); Copy
fmt.step(1, 'Creating Directory Structure');
Prints a step completion message with a bottom corner bracket and checkmark.
Optional
Optional completion message (defaults to 'Complete')
fmt.stepComplete('Directory created'); Copy
fmt.stepComplete('Directory created');
Returns highlighted text in Codeforces blue color.
Text to highlight
Styled text
fmt.info(`Target: ${fmt.highlight('all')}`); Copy
fmt.info(`Target: ${fmt.highlight('all')}`);
Returns dimmed/grayed text.
Text to dim
fmt.info(`${fmt.dim('(optional)')}`); Copy
fmt.info(`${fmt.dim('(optional)')}`);
Returns bold text.
Text to make bold
console.log(fmt.bold('Important:')); Copy
console.log(fmt.bold('Important:'));
Returns text in Codeforces red accent color (#FF6B6B).
Text to style
fmt.log(`Error: ${fmt.accent('Failed')}`); Copy
fmt.log(`Error: ${fmt.accent('Failed')}`);
Returns text in Codeforces primary blue color (#1E88E5).
fmt.info(`Main solution: ${fmt.primary(mainSolution.name)}`); Copy
fmt.info(`Main solution: ${fmt.primary(mainSolution.name)}`);
Prints a success box with green border and celebration emoji. Used for final success messages.
Success message to display
fmt.successBox('TEMPLATE CREATED SUCCESSFULLY!'); Copy
fmt.successBox('TEMPLATE CREATED SUCCESSFULLY!');
Prints an error box with red border and cross emoji. Used for final error messages.
Error message to display
fmt.errorBox('VALIDATION FAILED!'); Copy
fmt.errorBox('VALIDATION FAILED!');
Formatter class for creating styled terminal output with Codeforces theme. Uses chalk library for coloring with custom hex colors (#1E88E5 blue, #FF6B6B red).
Formatter
Example