Skip to content

scale-color $lightness must use $secondary for dark themes#7

Draft
ShashankFC wants to merge 1 commit into
theme-color-scheme-prefrom
theme-color-scheme-post
Draft

scale-color $lightness must use $secondary for dark themes#7
ShashankFC wants to merge 1 commit into
theme-color-scheme-prefrom
theme-color-scheme-post

Conversation

@ShashankFC

Copy link
Copy Markdown
Collaborator

@ShashankFC

Copy link
Copy Markdown
Collaborator Author

@claude

@claude

claude Bot commented Jan 7, 2026

Copy link
Copy Markdown

Claude finished @ShashankFC's task in 2m 17s —— View job


PR Review

Reviewing the changes to ensure scale-color $lightness correctly uses $secondary for dark themes.

Todo List

  • Read repository guidelines (CLAUDE.md)
  • Examine PR diff to understand changes
  • Review SCSS file changes for correctness and consistency
  • Provide comprehensive review feedback

Review Summary

This PR systematically updates 32 SCSS files to ensure that scale-color with $lightness parameters works correctly for both light and dark themes. The changes replace direct scale-color($primary, $lightness: X%) calls with dark-light-choose(scale-color($primary, $lightness: X%), scale-color($secondary, $lightness: Y%)).

✅ What's Working Well

  1. Systematic Approach: All 230 lines changed follow a consistent pattern across 32 files, demonstrating a thorough refactor
  2. Correct Function Usage: The dark-light-choose() function correctly checks if brightness($primary) < brightness($secondary) to determine theme type
  3. Lightness Inversion Logic: The changes properly invert lightness values for dark themes:
    • $lightness: 50%$lightness: 50% (neutral, no change needed)
    • $lightness: 70%$lightness: 30% (light theme lightens, dark theme darkens)
    • $lightness: 75%$lightness: 25% (inverse relationship maintained)
    • $lightness: 60%$lightness: 40% (proper inversion)

🔍 Issues Found

1. Inconsistent Lightness Inversion (app/assets/stylesheets/common/admin/admin_base.scss:506)

Location: app/assets/stylesheets/common/admin/admin_base.scss:506

color: dark-light-choose(scale-color($primary, $lightness: 40%), scale-color($secondary, $lightness: 60%));

Issue: The dark theme value should be $lightness: 60% but this creates a lighter color on dark backgrounds, which is correct for readability. However, this is inconsistent with the mathematical inversion pattern used elsewhere.

Expected Pattern: 40% → 60% inverts correctly to maintain contrast
Status: ✅ Actually correct for this use case (help text needs to be lighter on dark backgrounds)

2. Edge Case: Neutral 50% Values

Locations: Multiple files (e.g., _topic-list.scss:48, topic-post.scss:34)

color: dark-light-choose(scale-color($primary, $lightness: 50%), scale-color($secondary, $lightness: 50%));

Observation: When lightness is 50%, both light and dark themes use the same percentage. This is mathematically neutral but may not provide optimal contrast in both themes.

Status: ⚠️ Consider if these should actually be inverted (50% → 50% vs 50% → 50% is the same, but the actual visual result depends on the base colors)

3. Potential Oversight: Missing Category Badge Update

Location: app/assets/stylesheets/common/base/_topic-list.scss:115

.category .badge-notification {
  background-color:transparent;
  color: scale-color($primary, $lightness: 50%);
}

Issue: This line still uses the old pattern without dark-light-choose(). This appears to have been missed in the refactor.

Impact: Category badge notifications may not render correctly in dark themes.

Fix: Should be updated to:

color: dark-light-choose(scale-color($primary, $lightness: 50%), scale-color($secondary, $lightness: 50%));

4. Another Missed Instance: Unseen Topics

Location: app/assets/stylesheets/common/base/_topic-list.scss:172

.unseen {
  background-color: transparent;
  padding: 0;
  border: 0;
  color: scale-color($danger, $lightness: 20%);
  font-size: 0.929em;
  cursor: default;
}

Observation: This uses $danger instead of $primary, so it may have been intentionally excluded. However, it should still be reviewed for dark theme compatibility.

Status: ⚠️ Verify if this needs dark theme treatment

5. Selected Posts Button Still Uses Old Pattern

Location: app/assets/stylesheets/desktop/topic-post.scss:843-851

.btn {
  border: none;
  color: $secondary;
  font-weight: normal;
  margin-bottom: 10px;
  background: scale-color($tertiary, $lightness: 50%);
  
  &:hover {
    color: $secondary;
    background: scale-color($tertiary, $lightness: 20%);
  }

Issue: Uses scale-color($tertiary, ...) without dark-light-choose(). This may be intentional since it's using $tertiary instead of $primary, but should be verified.

Status: ⚠️ Verify if tertiary colors need dark theme handling

📊 Statistics

  • Files Modified: 32
  • Lines Changed: 230 (115 additions, 115 deletions)
  • Pattern Consistency: ~98% (2 potential misses found)
  • Lightness Inversion Accuracy: Correct for all updated lines

🎯 Recommendations

  1. Review line 115 in _topic-list.scss: Update the missed scale-color($primary, $lightness: 50%) to use dark-light-choose()
  2. Consider $tertiary and $danger colors: Document whether these color variables need similar dark theme treatment
  3. Add visual testing: Test the changes in both light and dark themes to verify contrast ratios meet accessibility standards
  4. Document the pattern: Consider adding a comment explaining the lightness inversion formula for future maintainers

Verdict

Overall Assessment: ✅ Approve with minor fixes recommended

The PR successfully addresses the core issue of making scale-color work correctly with dark themes. The transformation pattern is mathematically sound and consistently applied. However, there are 2-3 instances that appear to have been missed and should be reviewed for completeness.


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.

2 participants