Skip to content

fix: add neutral to accentColorIds in prehydration#1797

Merged
serhalp merged 1 commit intonpmx-dev:mainfrom
mcontrib:fix/accent-color-prehydration
Mar 1, 2026
Merged

fix: add neutral to accentColorIds in prehydration#1797
serhalp merged 1 commit intonpmx-dev:mainfrom
mcontrib:fix/accent-color-prehydration

Conversation

@maxchang3
Copy link
Contributor

🔗 Linked issue

Fixes #1792

🧭 Context

neutral was missing from accentColorIds, so the has() check skipped it on page load, and --accent-color was not applied, falling back to the CSS default.

📚 Description

  • Added neutral to accentColorIds
  • Reordered entries to match ACCENT_COLORS

A better way to enforce exhaustiveness of accentColorIds against AccentColorId may be worth exploring.

@vercel
Copy link

vercel bot commented Mar 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Mar 1, 2026 8:11pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Mar 1, 2026 8:11pm
npmx-lunaria Ignored Ignored Mar 1, 2026 8:11pm

Request Review

@maxchang3 maxchang3 force-pushed the fix/accent-color-prehydration branch from 0d81b5d to 104f161 Compare March 1, 2026 20:09
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b8e8976 and 104f161.

📒 Files selected for processing (1)
  • app/utils/prehydrate.ts

📝 Walkthrough

Walkthrough

This pull request modifies the accent colour ID validation set in app/utils/prehydrate.ts by expanding it from a single-line to a multi-line array format and adding the 'neutral' value to the collection of valid accent identifiers. The set continues to serve its existing purpose of validating the accentColorId and applying the corresponding CSS variable. No changes to the validation logic or control flow are introduced.

Possibly related PRs

Suggested reviewers

  • danielroe
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The pull request description clearly relates to the changeset, explaining the root cause of the issue and the changes made.
Linked Issues check ✅ Passed The pull request successfully addresses the linked issue #1792 by adding the missing 'neutral' value to accentColorIds.
Out of Scope Changes check ✅ Passed All changes in the pull request are directly scoped to fixing the accent color prehydration issue described in #1792.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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 and usage tips.

@codecov
Copy link

codecov bot commented Mar 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Copy link
Member

@serhalp serhalp left a comment

Choose a reason for hiding this comment

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

Thanks for fixing!

(💭 I think this has regressed a couple times, so we're probably due for an integration or e2e test of some sort.)

@serhalp serhalp added this pull request to the merge queue Mar 1, 2026
Merged via the queue into npmx-dev:main with commit 6722945 Mar 1, 2026
18 checks passed
@github-actions
Copy link

github-actions bot commented Mar 1, 2026

Thanks for your first contribution, @maxchang3! 💫

We'd love to welcome you to the npmx community. Come and say hi on Discord! And once you've joined, visit npmx.wamellow.com to claim the contributor role.

@maxchang3
Copy link
Contributor Author

maxchang3 commented Mar 1, 2026

(💭 I think this has regressed a couple times, so we're probably due for an integration or e2e test of some sort.)

This is what I came up with, though I wasn't sure about a better approach. Maybe worth trying in-source testing to directly access accentColorIds.

Another approach that comes to mind is using satisfies operator.

// I randomly copied `UnionToTuple` from https://github.com/type-challenges/type-challenges/issues/737,
// A simpler alternative is to export an `ACCENT_COLOR_IDS` array as a `const`.

// Valid accent color IDs (must match --swatch-* variables defined in main.css)
const accentColorIds = new Set([
  'sky',
  'coral',
  'amber',
  'emerald',
  'violet',
  'magenta',
  'neutral',
] as const satisfies UnionToTuple<AccentColorId>)

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.

npmx has an accent style even when turned off in settings

2 participants