Skip to content

Add Theme/Configuration Support for UserOutput #124

Closed

Description

@josecelano

Overview

Extract emoji symbols from UserOutput methods into a configurable Theme struct. This enables support for different output styles (emoji, plain text, ASCII) based on environment or user preferences, making the application more accessible and CI/CD-friendly.

Specification

See detailed specification: docs/issues/124-add-theme-configuration-support.md

🏗️ Architecture Requirements

DDD Layer: Presentation
Module Path: src/presentation/user_output.rs
Pattern: Configuration/Theme Pattern

Module Structure Requirements

  • Create Theme struct within user_output.rs module
  • Implement predefined theme constructors (emoji(), plain(), ascii())
  • Implement Default trait for Theme (emoji theme)
  • Update UserOutput to use Theme for all symbol formatting
  • Follow module organization conventions (see docs/contributing/module-organization.md)

Architectural Constraints

  • No breaking changes: Existing code using default constructor continues to work
  • Backward compatibility: Default theme uses emoji (current behavior)
  • Extensibility: Easy to add new themes without modifying output methods
  • Type safety: Theme fields are strongly typed
  • Immutability: Theme is set at construction, not modified during runtime

Anti-Patterns to Avoid

  • ❌ Global mutable theme - Don't use static mutable for theme configuration
  • ❌ Runtime theme switching - Theme is set at construction, not changed afterward
  • ❌ Hardcoded symbols in methods - All symbols must come from Theme

Implementation Plan

Phase 1: Create Theme Struct (1-2 hours)

  • Create Theme struct with symbol fields
  • Implement Theme::emoji(), Theme::plain(), Theme::ascii()
  • Implement accessor methods and Default trait
  • Add comprehensive documentation

Phase 2: Add Unit Tests for Theme (1 hour)

  • Test all predefined themes
  • Test accessor methods
  • Test theme cloning and equality

Phase 3: Integrate Theme into UserOutput (2-3 hours)

  • Add theme: Theme field to UserOutput
  • Create UserOutput::with_theme() constructor
  • Update all output methods to use self.theme.X_symbol()
  • Remove hardcoded symbols

Phase 4: Update Tests (2-3 hours)

  • Update test infrastructure to support themes
  • Add tests for each theme variant
  • Verify all existing tests pass

Phase 5: Documentation and Verification (1 hour)

  • Add module documentation
  • Add usage examples
  • Run pre-commit checks: ./scripts/pre-commit.sh

Acceptance Criteria

Note for Contributors: These criteria define what the PR reviewer will check. Use this as your pre-review checklist before submitting the PR to minimize back-and-forth iterations.

Quality Checks:

  • Pre-commit checks pass: ./scripts/pre-commit.sh

Theme Implementation Checks:

  • Theme struct exists with all symbol fields
  • All predefined themes implemented: emoji(), plain(), ascii()
  • Default trait returns emoji theme
  • All accessor methods implemented

Integration Checks:

  • UserOutput has theme: Theme field
  • UserOutput::with_theme() constructor exists
  • All output methods use theme symbols (no hardcoded symbols)

Testing Checks:

  • Theme unit tests cover all variants
  • Test infrastructure supports theme injection
  • All existing tests pass

Backward Compatibility Checks:

  • Default UserOutput::new() uses emoji theme
  • No breaking changes to public API

Documentation Checks:

  • Theme system fully documented
  • Usage examples for each theme
  • Each theme variant documented with use case

Related

Activity

  1. added 3 commits that reference this issue on Nov 3, 2025
  2. added a commit that references this issue on Nov 4, 2025
  3. added 2 commits that reference this issue on Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions