Skip to content

fix: improve contrast of unselected year buttons in dark mode#344

Open
HoussemEddineChaouch wants to merge 4 commits into
PRODHOSH:mainfrom
HoussemEddineChaouch:fix/heatmap-year-button-contrast
Open

fix: improve contrast of unselected year buttons in dark mode#344
HoussemEddineChaouch wants to merge 4 commits into
PRODHOSH:mainfrom
HoussemEddineChaouch:fix/heatmap-year-button-contrast

Conversation

@HoussemEddineChaouch

@HoussemEddineChaouch HoussemEddineChaouch commented Jul 8, 2026

Copy link
Copy Markdown

Summary

This PR improves accessibility for users by enhancing the visibility of the unselected year text in the heatmap. Previously, the text had low contrast, making it difficult to notice, especially in dark mode. This update increases the contrast in dark mode and adjusts it in light mode as well, resulting in better readability and an improved user experience.

Related Issue

Closes #286

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor
  • Chore / dependency update

Changes Made

  • Added --color-nav-mute CSS variable in globals.css (defaults to --color-ink-mute in light mode, #c2c2c2 in dark mode)
  • Updated HeatmapWithYearNav.tsx to use --color-nav-mute instead of --color-ink-mute for unselected year button text
  • Verified new contrast ratio is ~9.1:1 against the button background, passing WCAG AA

AI Usage

  • I did not use AI for any part of the code in this PR
  • I used AI for coding (specify which tool below) and I fully understand every change I made, including which functions I changed, why I changed them, and what side effects they could create

Tool Name : Used Claude Code for coding

Screenshots (if UI change)

image

Checklist

  • I was assigned to the issue before opening this PR
  • My branch is up to date with main
  • Code works locally and I have tested it
  • No console.log left in src/
  • If schema changed — N/A
  • If this is a UI change — I read DESIGN.md and followed the design system
  • Docs updated if needed — N/A
  • PR title follows Conventional Commits format (fix:)
  • This PR description is written in my own words

Summary by CodeRabbit

  • Style
    • Refined the contribution heatmap and year navigation visuals, including updated muted text styling and cleaner spacing/alignment across the year toggle and grid cells.
    • Improved theme consistency by reformatting dark-mode and page transition styling while keeping the same timings and respecting reduced-motion settings.
    • Reformatted pulse keyframes and related selectors for consistent styling without changing pulse opacity behavior.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Welcome to OSSfolio, @HoussemEddineChaouch! 🎉

Thank you for opening this pull request and contributing to the open-source community! 🚀

To ensure a smooth review process, please make sure you have:

  • Checked that your changes work locally and compile cleanly.
  • Followed the guidelines outlined in CONTRIBUTING.md.
  • Linked your PR to an open issue (e.g. Closes #ISSUE_NUMBER).

We will review your PR as soon as possible. Happy coding! 💻✨

@github-actions github-actions Bot added frontend Related to UI / Next.js UI Visual / design changes labels Jul 8, 2026
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@HoussemEddineChaouch, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 48 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 337c5d02-8ad0-45c9-a707-b242d39469b8

📥 Commits

Reviewing files that changed from the base of the PR and between 898d4c4 and 1f44422.

📒 Files selected for processing (1)
  • src/app/globals.css
📝 Walkthrough

Walkthrough

Adds a --color-nav-mute CSS variable for unselected heatmap year buttons, reformats related CSS and JSX without changing most values or logic, and removes the closing brace from the .sr-only rule.

Changes

Contrast Fix and Formatting Cleanup

Layer / File(s) Summary
Add --color-nav-mute and root variable reformatting
src/app/globals.css
Introduces the navigation-muted color token and reformats root and dark-mode variable declarations.
Apply the new token to year buttons
src/components/profile/HeatmapWithYearNav.tsx
Unselected year buttons use var(--color-nav-mute) instead of var(--color-ink-mute).
Reformat global CSS and heatmap component
src/app/globals.css, src/components/profile/HeatmapWithYearNav.tsx
Reformats transitions, animation, reduced-motion selectors, fetch logic, layout styles, filtering, grid rendering, legend, and explanatory JSX. The .sr-only closing brace is removed.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: PRODHOSH

Poem

A rabbit found a muted hue,
And made the year buttons clear to view.
CSS lines hopped into a row,
While heatmap JSX learned to flow.
One brace vanished—mind the trail! 🐰

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The diff includes an unrelated .sr-only closing-brace removal in globals.css, which looks like an accidental regression outside the contrast fix. Restore the .sr-only closing brace and keep the CSS changes limited to the year-button contrast update.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: improving dark-mode contrast for unselected year buttons.
Linked Issues check ✅ Passed The PR updates unselected year text to use --color-nav-mute, with a lighter dark-mode value, which addresses issue #286.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@PRODHOSH

PRODHOSH commented Jul 8, 2026

Copy link
Copy Markdown
Owner

@HoussemEddineChaouch fix the ci build error

@PRODHOSH PRODHOSH self-requested a review July 8, 2026 09:08
@PRODHOSH PRODHOSH added ELUSOC ELUSOC project submission in-progress ADVENTURER Intermediate — 25 pts labels Jul 8, 2026
@HoussemEddineChaouch

Copy link
Copy Markdown
Author

@HoussemEddineChaouch fix the ci build error

Fixed ,build failure was unrelated to the contrast fix, it was a lockfile drift (npm ci error: missing @swc/helpers@0.5.23). Merged latest main to sync package-lock.json and pushed. Verified npm ci, lint, type-check, and build all pass locally. Re-running CI now.

@PRODHOSH

PRODHOSH commented Jul 9, 2026

Copy link
Copy Markdown
Owner

@HoussemEddineChaouch fix the ci build error

Fixed ,build failure was unrelated to the contrast fix, it was a lockfile drift (npm ci error: missing @swc/helpers@0.5.23). Merged latest main to sync package-lock.json and pushed. Verified npm ci, lint, type-check, and build all pass locally. Re-running CI now.

can u still fix the build error and then i will merge @HoussemEddineChaouch
and is this pr part of ELUSOC PROGRAM ?

@PRODHOSH

Copy link
Copy Markdown
Owner

@HoussemEddineChaouch ?

…tton-contrast

# Conflicts:
#	package-lock.json
#	src/components/profile/HeatmapWithYearNav.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/profile/HeatmapWithYearNav.tsx`:
- Around line 293-294: Replace the index-based key on the contribution grid week
element in HeatmapWithYearNav with a stable date-based key derived from the
week’s identity, such as the first day’s date, while preserving a safe fallback
for empty weeks.
- Around line 263-266: Update the unselected text color for both toggle buttons
in the heatmap view, including the “Last 365 Days” button and the “Calendar
Year” button, to use var(--color-nav-mute) instead of var(--color-ink-mute);
preserve the existing selected-state colors and background behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: be0b591e-7601-4134-ba17-95f9377cd7b3

📥 Commits

Reviewing files that changed from the base of the PR and between 64c362e and 898d4c4.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • src/components/profile/HeatmapWithYearNav.tsx

Comment on lines +263 to +266
color:
viewMode === "calendar" ? "#171717" : "var(--color-ink-mute)",
backgroundColor:
viewMode === "calendar" ? "#3ecf8e" : "transparent",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Toggle button unselected text still uses var(--color-ink-mute).

The "Calendar Year" toggle button (and its "Last 365 Days" sibling at Line 246) uses var(--color-ink-mute) for the unselected state — the same token that caused the low-contrast issue this PR fixes for year buttons. In dark mode, these toggle buttons will exhibit the same readability problem. Consider switching both to var(--color-nav-mute) for consistency.

♿ Proposed fix for toggle button contrast consistency
               fontSize: "12px",
               fontWeight: viewMode === "365" ? 600 : 400,
-              color: viewMode === "365" ? "`#171717`" : "var(--color-ink-mute)",
+              color: viewMode === "365" ? "`#171717`" : "var(--color-nav-mute)",
               backgroundColor: viewMode === "365" ? "`#3ecf8e`" : "transparent",

And similarly for the calendar button:

                 fontWeight: viewMode === "calendar" ? 600 : 400,
                 color:
-                  viewMode === "calendar" ? "`#171717`" : "var(--color-ink-mute)",
+                  viewMode === "calendar" ? "`#171717`" : "var(--color-nav-mute)",
                 backgroundColor:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
color:
viewMode === "calendar" ? "#171717" : "var(--color-ink-mute)",
backgroundColor:
viewMode === "calendar" ? "#3ecf8e" : "transparent",
color:
viewMode === "calendar" ? "`#171717`" : "var(--color-nav-mute)",
backgroundColor:
viewMode === "calendar" ? "`#3ecf8e`" : "transparent",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/profile/HeatmapWithYearNav.tsx` around lines 263 - 266, Update
the unselected text color for both toggle buttons in the heatmap view, including
the “Last 365 Days” button and the “Calendar Year” button, to use
var(--color-nav-mute) instead of var(--color-ink-mute); preserve the existing
selected-state colors and background behavior.

Comment on lines +293 to +294
<div
key={wi}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider stable keys for contribution grid weeks.

Static analysis flags the use of array index keys (key={wi}). If the week array can reorder (e.g., when switching between "365" and "calendar" views changes the filtered set), React may reuse DOM nodes incorrectly. This is a pre-existing pattern, but if week identity is stable, consider using a date-based key (e.g., week.days[0]?.date) instead.

🧰 Tools
🪛 React Doctor (0.5.8)

[warning] 294-294: Your users can see & submit the wrong data when this list reorders.

Use a stable key from your data so reordered items keep the right state and DOM.

(no-array-index-key)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/profile/HeatmapWithYearNav.tsx` around lines 293 - 294,
Replace the index-based key on the contribution grid week element in
HeatmapWithYearNav with a stable date-based key derived from the week’s
identity, such as the first day’s date, while preserving a safe fallback for
empty weeks.

Source: Linters/SAST tools

@PRODHOSH

PRODHOSH commented Jul 12, 2026

Copy link
Copy Markdown
Owner

@HoussemEddineChaouch pls comment here whether this pr is part of ELUSOC

@HoussemEddineChaouch

Copy link
Copy Markdown
Author

@HoussemEddineChaouch ?

@PRODHOSH No, this isn't part of ELUSOC ,I just came across the issue and wanted to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ADVENTURER Intermediate — 25 pts ELUSOC ELUSOC project submission frontend Related to UI / Next.js in-progress UI Visual / design changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Fix text contrast for year buttons in Heatmap

2 participants