Skip to content

Commit a0fb155

Browse files
committed
fix: support Tailwind opacity modifiers with CSS variable accent colors
The accent colors were changed from hardcoded hex to CSS variables for per-campaign theming, but Tailwind v3 cannot decompose var() values to apply opacity modifiers (/20, /10, etc.), breaking all @apply directives using accent/{opacity} (16 occurrences). Fix: add parallel --color-accent-rgb CSS custom properties holding space-separated RGB channels. Tailwind config uses these with the <alpha-value> placeholder for opacity support. Raw CSS/JS continues using the hex-based --color-accent variables unchanged. https://claude.ai/code/session_01WJEjfBqjZaGatHiXXXDupo
1 parent aedfce4 commit a0fb155

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

static/css/input.css

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
--color-accent: #6366f1; /* indigo-500 */
3838
--color-accent-hover: #4f46e5; /* indigo-600 -- darker for hover states */
3939
--color-accent-light: #a5b4fc; /* indigo-300 -- lighter for badges/tags */
40+
/* RGB channel variants for Tailwind opacity modifier support (<alpha-value>). */
41+
--color-accent-rgb: 99 102 241;
42+
--color-accent-hover-rgb: 79 70 229;
43+
--color-accent-light-rgb: 165 180 252;
4044
--color-sidebar-bg: #1a1c23; /* always dark */
4145
}
4246

@@ -57,6 +61,9 @@
5761
--color-accent: #6366f1; /* indigo-500 -- same both modes */
5862
--color-accent-hover: #4f46e5; /* indigo-600 */
5963
--color-accent-light: #a5b4fc; /* indigo-300 */
64+
--color-accent-rgb: 99 102 241;
65+
--color-accent-hover-rgb: 79 70 229;
66+
--color-accent-light-rgb: 165 180 252;
6067
--color-sidebar-bg: #1a1c23; /* always dark */
6168
}
6269

@@ -83,7 +90,7 @@
8390
}
8491
.btn-primary {
8592
@apply btn bg-accent text-white hover:bg-accent-hover
86-
focus:ring-accent shadow-sm hover:shadow-md hover:shadow-indigo-500/20;
93+
focus:ring-accent shadow-sm hover:shadow-md hover:shadow-accent/20;
8794
}
8895
.btn-secondary {
8996
@apply btn bg-surface text-fg-body hover:bg-surface-alt
@@ -845,7 +852,7 @@
845852

846853
/* Reorg mode active indicator on toggle button. */
847854
#sidebar-reorg-toggle.bg-accent\/20 {
848-
background-color: rgba(var(--color-accent-rgb, 99, 102, 241), 0.2);
855+
background-color: rgb(var(--color-accent-rgb, 99 102 241) / 0.2);
849856
}
850857

851858
/* Tree toggle button styling. */

tailwind.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ module.exports = {
4040
// Accent color for links, buttons, active states.
4141
// References CSS custom property so per-campaign overrides work.
4242
accent: {
43-
DEFAULT: 'var(--color-accent, #6366f1)',
44-
hover: 'var(--color-accent-hover, #4f46e5)',
45-
light: 'var(--color-accent-light, #a5b4fc)',
43+
DEFAULT: 'rgb(var(--color-accent-rgb, 99 102 241) / <alpha-value>)',
44+
hover: 'rgb(var(--color-accent-hover-rgb, 79 70 229) / <alpha-value>)',
45+
light: 'rgb(var(--color-accent-light-rgb, 165 180 252) / <alpha-value>)',
4646
},
4747

4848
// ── Semantic theme tokens ──────────────────────────────

0 commit comments

Comments
 (0)