Convert styles to use var(--color) correctly#954
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 WalkthroughWalkthrough
ChangesColor Value Transformation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@convert/convertStyles.ts`:
- Around line 105-107: The current regex and replace mutate any earlier
occurrence of the token and wrongly rewrite values like "currentColor"; update
the logic in convertStyles.ts to match and replace only the color property value
itself (not the whole line) by using a regex that captures the "color:"
declaration and the value (e.g.
/(color:\s*)(?!var\(--)(?!currentColor\b)([A-Za-z0-9_-]+Color\b)/i) and then
call line = line.replace(thatRegex, (_m, p1, p2) => `${p1}var(--${p2})`), so the
replacement is scoped to the matched declaration value and excludes
"currentColor" and values already using var(--...).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
SAB/DAB output styles that set color to some variable, but omit the required CSS syntax (I assume there is a difference in how Android handles CSS variables...)
Before:
After:
Summary by CodeRabbit