Skip to content

[Refactor]: Consolidate duplicate color/theme definitions into a single file #5

@Sandesh282

Description

@Sandesh282

Description:

The app's color palette is currently defined across multiple files, creating duplication and inconsistency. There are two separate theming systems, one of which is entirely unused.

Current Behavior:

  1. ContentView.swift (lines 3–20) — Contains Color and UIColor extensions defining the actual colors used throughout the app (darkBackground, neonBlue, neonPurple, etc.).
  2. Theme.swift — Contains a separate Theme enum with system colors (Color(.systemBackground), Color.blue) that are never referenced anywhere in the codebase.
  3. ProblemModels.swift — Contains an unrelated Color(hex:) initializer extension mixed in with model code.

This structure is confusing for new contributors and makes the design system fragile.

Feature Requirements:

  • Create a dedicated color/theme file (e.g., CForge/Theme/AppColors.swift) or repurpose Theme.swift.
  • Move all Color extensions from ContentView.swift into this file.
  • Move the UIColor extensions from ContentView.swift into this file.
  • Move the Color(hex:) initializer from ProblemModels.swift into this file.
  • Remove the unused Theme enum or update it to reference the actual neon color palette.
  • Ensure ContentView.swift only contains the ContentView struct.

Steps to Implement:

  1. Create a new file CForge/Theme/AppColors.swift (or rename/repurpose Theme.swift).
  2. Move all Color and UIColor extensions from ContentView.swift into the new file.
  3. Move the Color(hex:) extension from ProblemModels.swift into the new file.
  4. Delete or update the unused Theme enum.
  5. Build (Cmd+B) and verify all views still compile — the extensions are global, so no import changes are needed.
  6. Run the app to confirm there are no visual regressions.

Expected Outcome:

  • All color and theme definitions live in a single, dedicated file.
  • ContentView.swift contains only view code.
  • ProblemModels.swift contains only model code.
  • The app looks and functions identically to before (pure refactor).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions