Skip to content

feat: Add colored console output support (fixes #15) - #17

Merged
smiley-maker merged 1 commit into
smiley-maker:mainfrom
majiayu000:feature/issue-15-colored-output
Dec 15, 2025
Merged

smiley-maker merged 1 commit into
smiley-maker:mainfrom
majiayu000:feature/issue-15-colored-output

Conversation

@majiayu000

Copy link
Copy Markdown
Contributor

Summary

Add a new colors module that provides ANSI color codes and utilities for personality-specific colored output.

Features

  • colorize() function to apply colors to text
  • strip_colors() function to remove ANSI codes
  • ColoredPrinter class for use as print_fn
  • Personality-specific color schemes

Usage

from emotigrad import EmotionalOptimizer, ColoredPrinter

printer = ColoredPrinter("hype")
emo_opt = EmotionalOptimizer(optimizer, personality="hype", print_fn=printer)

Test Plan

  • All 29 tests pass

Fixes #15

Add a new colors module that provides ANSI color codes and utilities
for personality-specific colored output.

Features:
- ANSI color constants (RED, GREEN, BLUE, BOLD, etc.)
- colorize() function to apply colors to text
- strip_colors() function to remove ANSI codes
- Personality-specific color schemes (PERSONALITY_COLORS)
- ColoredPrinter class for use as print_fn
- create_colored_print_fn() convenience function

Each personality has its own color scheme:
- wholesome: Green, bold
- sassy: Magenta, bold
- nervous: Yellow
- chaotic: Bright magenta, bold
- arrogant: Cyan, italic
- tired: Dim, italic
- hype: Bright yellow, bold
- academic: Blue
- pirate: Bright red, bold
- zen: Bright cyan, dim

Usage:
```python
from emotigrad import EmotionalOptimizer, ColoredPrinter

printer = ColoredPrinter("hype")
emo_opt = EmotionalOptimizer(optimizer, personality="hype", print_fn=printer)
```

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@smiley-maker

Copy link
Copy Markdown
Owner

Love this addition! The colored output makes the feedback much easier to read and adds a lot of personality to the training loop. Really appreciate you implementing this so cleanly and adding tests for the feature.

@smiley-maker
smiley-maker merged commit c4f042d into smiley-maker:main Dec 15, 2025
0 of 3 checks passed
@majiayu000
majiayu000 deleted the feature/issue-15-colored-output branch December 15, 2025 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add colored console output

2 participants