Files
tkmind_go/CSS_VARIABLE_AUDIT.md
T
Douwe Osinga 589f7c8279 Clean up css (#6944)
Co-authored-by: Douwe Osinga <douwe@squareup.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-05 23:07:20 +00:00

7.0 KiB

CSS Variable Usage Audit - Post-Cleanup

Summary

After the initial cleanup, there are still undefined variables being used in the codebase. The analysis reveals a complex picture with multiple naming conventions.


Tailwind v4 Naming Pattern

Tailwind v4 generates utility classes from CSS custom properties defined in the @theme inline section:

Pattern:

CSS: --color-text-default
↓
Tailwind class: text-text-default

The class name = utility type (text) + variable name after --color- prefix (text-default)


Currently Defined Variables (from @theme inline)

Text Colors (defined = 7)

--color-text-defaulttext-text-default (112 uses) --color-text-mutedtext-text-muted (200 uses) --color-text-inversetext-text-inverse (14 uses) --color-text-accenttext-text-accent (1 use) --color-text-on-accenttext-on-accent (16 uses) --color-text-dangertext-text-danger (3 uses) --color-text-successtext-text-success (0 uses) --color-text-warningtext-text-warning (1 use) --color-text-infotext-text-info (1 use)

Background Colors (defined = 7)

--color-background-defaultbg-background-default (115 uses) --color-background-mutedbg-background-muted (82 uses) --color-background-mediumbg-background-medium (15 uses) --color-background-inversebg-background-inverse (5 uses) --color-background-accentbg-background-accent (12 uses) --color-background-dangerbg-background-danger (10 uses) --color-background-infobg-background-info (1 use) --color-background-cardbg-background-card (3 uses)

Border Colors (defined = 4)

--color-border-defaultborder-border-default (25 uses) --color-border-strongborder-border-strong (6 uses) --color-border-accentborder-border-accent (3 uses) --color-border-dangerborder-border-danger (0 uses) --color-border-infoborder-border-info (1 use)


UNDEFINED Variables Still Being Used

Text (5 undefined)

text-text-subtle (12 uses) - no --color-text-subtle defined textProminentInverse (2 uses) - non-standard camelCase textPlaceholder (9 uses) - non-standard camelCase

Background (6 undefined)

bg-background-defaultInverse (2 uses) - camelCase, not defined bg-background-primary (1 use) - not defined bg-background-panel (1 use) - not defined bg-background-light (1 use) - not defined bg-background-dark (1 use) - not defined bgStandardInverse (2 uses) - non-standard camelCase

Border (2 undefined)

border-border-muted (5 uses) - no --color-border-muted defined border-border-focus (2 uses) - no --color-border-focus defined

Total: 42 uses of undefined variables


Alternative Class Usage (Non-Tailwind v4 Pattern)

Some code uses shortened class names that may work via Tailwind's default utilities:

  • text-default (176 uses) - instead of text-text-default
  • border-default (62 uses) - instead of border-border-default
  • text-muted (27 uses) - instead of text-text-muted
  • text-inverse (2 uses) - instead of text-text-inverse
  • text-danger (5 uses) - instead of text-text-danger
  • text-info (3 uses) - instead of text-text-info

These may be:

  1. Tailwind generating classes from the :root variables (e.g., --text-default)
  2. Custom utility classes
  3. Inconsistent usage that should be standardized

Issues to Fix

Priority 1: Undefined Variables (42 uses)

These MUST be fixed:

Variable Uses Suggested Fix
text-text-subtle 12 Add --color-text-subtle OR replace with text-text-muted
border-border-muted 5 Add --color-border-muted OR replace with border-border-default
border-border-focus 2 Add --color-border-focus OR replace with border-border-strong
textProminentInverse 2 Replace with text-text-inverse
textPlaceholder 9 Add --color-text-placeholder or use existing
bgStandardInverse 2 Replace with bg-background-inverse
bg-background-defaultInverse 2 Replace with bg-background-inverse
bg-background-primary 1 Replace with bg-background-default
bg-background-panel 1 Replace with bg-background-card
bg-background-light 1 Replace with bg-background-muted (light mode specific)
bg-background-dark 1 Replace with bg-background-medium (dark mode specific)

Priority 2: Naming Inconsistency (268 uses)

Standardize on Tailwind v4 pattern:

Current Uses Should Be
text-default 176 text-text-default or define properly
border-default 62 border-border-default or define properly
text-muted 27 text-text-muted or define properly
text-inverse 2 text-text-inverse or define properly
text-danger 5 text-text-danger or define properly

Recommendations

Option 1: Complete Tailwind v4 Compliance

  • Add missing --color-* variables to @theme inline
  • Replace all shortened names with full Tailwind v4 pattern
  • Standardize on text-text-*, bg-background-*, border-border-*

Option 2: Simplify to Direct Variables

  • Keep :root variables like --text-default, --background-muted
  • Remove @theme inline section or simplify it
  • Use shorter class names consistently: text-default, bg-muted, border-default
  • Less redundant, more readable

Option 3: Hybrid Approach

  • Keep Tailwind v4 for theme-able variables (backgrounds, text, borders)
  • Add missing variables for gaps
  • Accept some inconsistency where it exists

Current Usage Statistics

Total CSS Class Usage

  • Background classes: 248 uses

    • Defined: 233 uses (94%)
    • Undefined: 8 uses (3%)
    • Alternative syntax: 7 uses (3%)
  • Text classes: 461 uses

    • Defined (Tailwind v4 pattern): 238 uses (52%)
    • Alternative syntax: 213 uses (46%)
    • Undefined: 10 uses (2%)
  • Border classes: 93 uses

    • Defined: 38 uses (41%)
    • Alternative syntax: 48 uses (52%)
    • Undefined: 7 uses (7%)

Next Steps Decision Needed

Before proceeding with MCP migration, we need to decide:

  1. Which naming convention to use?

    • Full Tailwind v4 (text-text-default) - more verbose but explicit
    • Shortened (text-default) - cleaner but less clear what's custom vs. Tailwind default
  2. Should we add the missing variables or replace with existing ones?

    • Add: --color-text-subtle, --color-border-muted, etc.
    • Replace: Use existing similar variables
  3. How to handle the camelCase variables?

    • textProminentInverse, textPlaceholder, bgStandardInverse
    • These seem to be older conventions that should be migrated

Recommendation:

  • Fix all undefined variables (42 uses)
  • Standardize on ONE naming pattern before MCP migration
  • Add missing semantic variables that make sense (text-subtle, border-muted)