fix(web): apply opacity modifiers to theme colors#1485
fix(web): apply opacity modifiers to theme colors#1485divyanshu-iitian wants to merge 3 commits into
Conversation
WalkthroughTailwind CSS-variable theme colors now support opacity modifiers through ChangesTailwind color opacity
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant TailwindConfig
participant TailwindCompiler
participant RuntimeTheme
participant Tests
TailwindConfig->>TailwindCompiler: Provide color-mix expressions with alpha placeholders
TailwindCompiler->>Tests: Compile opacity-modified utilities
TailwindConfig->>RuntimeTheme: Resolve configured theme colors
RuntimeTheme->>Tests: Expose colors with concrete opaque alpha values
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 `@CHANGELOG.md`:
- Line 11: Move the `#1485` “Applied Tailwind opacity modifiers…” entry to the
bottom of the Fixed section in CHANGELOG.md, after the existing `#1474` entry,
while preserving the entry text and link.
🪄 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: CHILL
Plan: Pro Plus
Run ID: b3246d6d-301f-49a8-bf69-daac3738faa1
📒 Files selected for processing (3)
CHANGELOG.mdpackages/web/tailwind.config.tspackages/web/tailwindConfig.test.ts
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit cfdf07f. Configure here.
e4633c6 to
63cdf1f
Compare

Fixes #387
Tailwind treated Sourcebot's complete CSS-variable colors as opaque values, so utilities such as
text-primary/80andbg-muted/50ignored their opacity modifiers.<alpha-value>placeholder andcolor-mix()noneandinherit) unchangedTesting:
yarn workspace @sourcebot/web test --run(93 files, 1128 tests)yarn workspace @sourcebot/web lint(0 errors; 6 existing warnings)yarn workspace @sourcebot/web buildNote
Low Risk
Styling-only change to Tailwind theme definitions and resolved color strings; limited blast radius with tests covering compiled CSS and runtime theme export.
Overview
Fixes Tailwind opacity utilities (e.g.
text-primary/80,bg-muted/50) on theme colors that were plainvar(--token)values, which Tailwind treated as opaque and ignored the/alpha.Theme colors now go through a shared
withOpacityhelper that wraps CSS variables incolor-mix(in srgb, … calc(<alpha-value> * 100%), transparent)so Tailwind can substitute opacity when building utilities. Semantic, sidebar, editor, chat, and related tokens are updated; a few editor tokens stay as rawvar(...)where opacity modifiers are not needed.Runtime config (
src/tailwind.ts) recursively replaces<alpha-value>with1(and the calc form with100%) on resolved theme colors so CodeMirror/search bar consumers get valid color strings instead of build-time placeholders.Tests compile sample utility classes and assert
color-mixoutput for opacity modifiers, and that the exported theme has no<alpha-value>left in JSON.Reviewed by Cursor Bugbot for commit 63cdf1f. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
color-mix(...)with real alpha values (and never the alpha placeholder).