Architecture Decisions
This page provides an overview of the key architectural decisions made in the Retro Floppy project. Each decision is documented in detail in an Architecture Decision Record (ADR).
What are ADRs?
Architecture Decision Records (ADRs) capture important architectural decisions along with their context and consequences. They help developers understand:
- Why certain approaches were chosen
- What alternatives were considered
- What trade-offs were made
- What the consequences are
Key Decisions
ADR-001: Use HSL Color Space for Gradient Generation
Status: Accepted
Summary: We chose HSL (Hue, Saturation, Lightness) as the primary color space for gradient generation instead of RGB, HSV, or LAB.
Key Benefits:
- Intuitive color theory mapping (hue = color wheel position)
- Easy analogous color generation (hue ± 30°)
- Simple pastel optimization (low saturation + high lightness)
- Native CSS support (no conversion needed)
Trade-offs:
- Not perceptually uniform (mitigated by testing)
- Requires conversion for luminance calculations (minimal overhead)
ADR-002: Dynamic Font Scaling with scaleX Transform
Status: Accepted
Summary: We use CSS scaleX() transform for dynamic font scaling instead of adjusting font-size, using scale(), or truncating text.
Key Benefits:
- GPU-accelerated (fast and smooth)
- Precise scaling (not limited to discrete font sizes)
- Maintains vertical readability
- No layout reflow
Trade-offs:
- Text can look condensed when heavily compressed (mitigated by 0.4 minimum scale)
- Requires measurement complexity (temporary transform removal)
Scale Bounds: 0.4 (40%) to 1.5 (150%)
ADR-003: Graceful Degradation Error Handling
Status: Accepted
Summary: We chose graceful degradation over fail-fast, fail-silent, or strict validation approaches.
Key Benefits:
- Component never crashes user applications
- Clear, actionable error messages in development
- Predictable fallback behavior
- Production-safe (no console spam)
Trade-offs:
- Developers might not notice invalid props (mitigated by TypeScript + warnings)
- Invalid props may render differently than expected (documented behavior)
Principles:
- Never throw errors
- Console warnings in development
- Fallback to safe defaults
- TypeScript for compile-time safety
ADR-004: Deterministic Gradient Generation
Status: Accepted
Summary: We use seeded pseudo-random number generation (Mulberry32) to create deterministic gradients from label names.
Key Benefits:
- Same label always has same gradient (consistency)
- No need to store gradient data (performance)
- Shareable (screenshots match live view)
- Predictable for users
Trade-offs:
- Can't get different gradient for same label (mitigated by custom seed option)
- Hash collisions possible but rare (~0.0001% for 1000 labels)
Algorithm: Label name → Hash → Seed → Mulberry32 PRNG → Colors
ADR-005: CSS Modules for Component Styling
Status: Accepted
Summary: We use CSS Modules for component styling instead of CSS-in-JS, Tailwind, plain CSS, or Sass.
Key Benefits:
- Scoped styles (no conflicts with user CSS)
- Zero runtime overhead (build-time transformation)
- TypeScript support (auto-generated
.d.tsfiles) - Standard CSS syntax (no learning curve)
Trade-offs:
- Requires build step (acceptable for modern React apps)
- Class name hashing makes debugging harder (mitigated by source maps)
- No dynamic styles (mitigated by CSS variables)
Customization: CSS variables expose all customizable values
Decision Process
When making architectural decisions, we consider:
- User Experience: How does this affect end users?
- Developer Experience: How does this affect developers using the library?
- Performance: What is the runtime and build-time cost?
- Maintainability: How easy is this to understand and modify?
- Flexibility: Can users customize or override this behavior?
- Standards: Does this align with web standards and best practices?
Contributing
When proposing a new architectural decision:
- Create a new ADR using the template
- Number it sequentially (e.g.,
006-my-decision.md) - Fill in all sections (Context, Decision, Consequences)
- Submit for review via pull request
- Update this index page
Full ADR Index
All ADRs are available in the docs/adr/ directory:
- ADR-001: Use HSL Color Space for Gradient Generation
- ADR-002: Dynamic Font Scaling with scaleX Transform
- ADR-003: Graceful Degradation Error Handling
- ADR-004: Deterministic Gradient Generation
- ADR-005: CSS Modules for Component Styling