Skip to content

feat: color system DX - dark fallback + theme-aware palette - #25

Merged
jackgranatowski merged 2 commits into
mainfrom
feat/color-system-dx-improvement
May 20, 2026
Merged

feat: color system DX - dark fallback + theme-aware palette#25
jackgranatowski merged 2 commits into
mainfrom
feat/color-system-dx-improvement

Conversation

@kiro-agent

@kiro-agent kiro-agent Bot commented May 19, 2026

Copy link
Copy Markdown

This pull request was created by @kiro-agent on behalf of @jackgranatowski 👻

Comment with /kiro fix to address specific feedback or /kiro all to address everything.
Learn about Kiro autonomous agent


Summary

Improves the color system developer experience and fixes issue #24.

Changes

  1. Dark-mode fallback to light values (core/tokens.css)

    • All 11 resolved color tokens (6 brand + 5 status) now use: light-dark(var(--X-light), var(--X-dark, var(--X-light)))
    • When a developer overrides only -light tokens, dark mode uses the same value instead of framework defaults
    • Developers who want custom dark mode still override -dark tokens explicitly
  2. Theme-aware palette (optional/tokens.palette.css) — fixes fix(palette): tints/shades mix with theme-aware tokens instead of literal white/black #24

    • Tints (100-400): whitevar(--sf-color-base)
    • Shades (600-900): blackvar(--sf-color-text)
    • Palette scale now adapts automatically to the active theme
  3. Updated documentation (core/tokens.css)

    • THEMOWANIE section now describes the simplified DX model
    • Minimal 6-token override example

DX Model

Scenario What to override Result
Quick branding 6 -light tokens Light = custom, Dark = same value (consistent brand)
Full theming 6 -light + 6 -dark Full control of both modes
Zero config Nothing Framework defaults in both modes

Trade-off

When only -light is set, dark mode uses the same color value. On dark backgrounds, a light-mode-optimized color (e.g. oklch(0.45)) may have suboptimal contrast. This is intentional — it's visible and predictable, and signals to the dev that adding a -dark override would improve the dark mode experience.

Summary by CodeRabbit

  • Improvements

    • Enhanced theme inheritance to support “quick branding”: override six light-brand tokens and have dark mode fall back automatically.
    • Color token generation now mixes against system base/text colors for more consistent tints/shades.
  • Documentation / Demo

    • Demo updated to load local assets, add a “Scoped Themes” section, and show nested light/dark theme scoping with live theme customizer text.

Review Change Stack

… palette

- Add dark-mode fallback to all 11 resolved color tokens so dark mode
  falls back to the light value when no explicit -dark override is set
- Replace literal white/black with var(--sf-color-base)/var(--sf-color-text)
  in palette color-mix() calls to make tint/shade scale theme-aware (fixes #24)
- Update THEMOWANIE documentation to reflect the new 6-token override model
@coderabbitai

coderabbitai Bot commented May 19, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f59d4235-879d-480f-9ac4-309fe835640f

📥 Commits

Reviewing files that changed from the base of the PR and between 8fd1de0 and 26658d5.

📒 Files selected for processing (1)
  • docs/demo.html

📝 Walkthrough

Walkthrough

Core semantic tokens now support quick-branding via light-only overrides with dark-side fallback; palette numeric scales mix with theme-aware base/text tokens instead of literal white/black; demo page links and documentation add a scoped-themes section and local asset loading.

Changes

Color Token Theming & Palette Fallback

Layer / File(s) Summary
Core token resolution with fallback documentation
core/tokens.css
Header docs updated to document quick branding by overriding six -light brand tokens; resolved semantic tokens (--sf-color-primary, --sf-color-secondary, --sf-color-tertiary, --sf-color-action, --sf-color-neutral, --sf-color-base, --sf-color-success, --sf-color-warning, --sf-color-error, --sf-color-info, --sf-color-danger) now wrap their dark fallback as var(--*-dark, var(--*-light)) inside light-dark() to fall back to light values when dark overrides are missing.
Brand palette tint/shade scale updates with theme-aware mix endpoints
optional/tokens.palette.css
Numeric scales for primary, secondary, tertiary, action, neutral, and base now use color-mix() with var(--sf-color-base) for lighter mixes and var(--sf-color-text) for darker mixes, replacing literal white/black anchors while preserving token names and percentages.
Demo asset links and scoped-themes documentation
docs/demo.html
Demo now loads local SLASHED CSS assets, adds a "Scoped Themes" nav entry, updates the Theme Customizer text to mention quick branding via -light overrides and live :root application, and introduces a #scoped-themes section with nested theme examples.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • codeslash-dev/SLASHED#23: Modifies core/tokens.css derived status/semantic token definitions; overlaps at token resolution layer.
  • codeslash-dev/SLASHED#17: Changes :root/color-token dark behavior and derives status/danger tokens; related to token resolution logic.
  • codeslash-dev/SLASHED#7: Adjusts handling of --sf-color-* dark/light variants and fallback behavior.

Suggested reviewers

  • jackgranatowski
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main changes: dark fallback mechanism and theme-aware palette improvements in the color system.
Linked Issues check ✅ Passed The PR implements all coding requirements from issue #24: palette tints mix with var(--sf-color-base), shades mix with var(--sf-color-text), and core tokens include dark fallback logic.
Out of Scope Changes check ✅ Passed All changes align with PR objectives: core/tokens.css dark fallback, optional/tokens.palette.css theme-aware mixing, and docs/demo.html documentation and demonstration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/color-system-dx-improvement

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

@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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
optional/tokens.palette.css (1)

12-13: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update outdated comment to reflect theme-aware implementation.

The comment still refers to mixing with literal white and black, but the implementation now mixes with var(--sf-color-base) and var(--sf-color-text) respectively.

📝 Proposed fix
   Token naming:
-    --sf-color-X-100  … -400  tints  (mixed with white)
-    --sf-color-X-600  … -900  shades (mixed with black)
+    --sf-color-X-100  … -400  tints  (mixed toward base)
+    --sf-color-X-600  … -900  shades (mixed toward text)
     --sf-color-X-a10  … -a75  alpha  (mixed with 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 `@optional/tokens.palette.css` around lines 12 - 13, Update the outdated
comment in tokens.palette.css that describes color mixing for the variables
(--sf-color-X-100 … -400 and --sf-color-X-600 … -900) to reflect the theme-aware
implementation: state that tints are created by mixing with var(--sf-color-base)
and shades by mixing with var(--sf-color-text) (instead of literal "white" and
"black"), and mention that this makes the palette respect current theme colors.
🤖 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 `@optional/tokens.palette.css`:
- Around line 115-118: The four base tint tokens (--sf-color-base-100,
--sf-color-base-200, --sf-color-base-300, --sf-color-base-400) currently mix
var(--sf-color-base) with itself which collapses to a single value; change the
second operand to var(--sf-color-text) so the scale ramps from base toward text
(i.e., use color-mix(in oklch, var(--sf-color-text) <percent>,
var(--sf-color-base)) and keep the intended percentages (8%, 20%, 40%, 65%) so
each token progressively shifts from the base color toward the text color).

---

Outside diff comments:
In `@optional/tokens.palette.css`:
- Around line 12-13: Update the outdated comment in tokens.palette.css that
describes color mixing for the variables (--sf-color-X-100 … -400 and
--sf-color-X-600 … -900) to reflect the theme-aware implementation: state that
tints are created by mixing with var(--sf-color-base) and shades by mixing with
var(--sf-color-text) (instead of literal "white" and "black"), and mention that
this makes the palette respect current theme colors.
🪄 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: e2087d73-2b9f-4efe-9707-ae9d6e498b6d

📥 Commits

Reviewing files that changed from the base of the PR and between 81ff4af and 8fd1de0.

⛔ Files ignored due to path filters (1)
  • dist/slashed.essential.css is excluded by !**/dist/**
📒 Files selected for processing (2)
  • core/tokens.css
  • optional/tokens.palette.css

Comment on lines +115 to +118
--sf-color-base-100: color-mix(in oklch, var(--sf-color-base) 8%, var(--sf-color-base));
--sf-color-base-200: color-mix(in oklch, var(--sf-color-base) 20%, var(--sf-color-base));
--sf-color-base-300: color-mix(in oklch, var(--sf-color-base) 40%, var(--sf-color-base));
--sf-color-base-400: color-mix(in oklch, var(--sf-color-base) 65%, var(--sf-color-base));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Base color tints collapse to a single value.

Lines 115–118 mix var(--sf-color-base) with itself, which algebraically reduces to 100% base for all tints (100, 200, 300, 400). This produces no useful tint scale. The PR objective explicitly states: "Special-case the base scale (--sf-color-base-*) so it ramps from base toward text rather than mixing base with itself."

To create a grayscale ramp from base to text, tints should also mix with var(--sf-color-text).

🎨 Proposed fix for base color tints
-    --sf-color-base-100: color-mix(in oklch, var(--sf-color-base)  8%, var(--sf-color-base));
-    --sf-color-base-200: color-mix(in oklch, var(--sf-color-base) 20%, var(--sf-color-base));
-    --sf-color-base-300: color-mix(in oklch, var(--sf-color-base) 40%, var(--sf-color-base));
-    --sf-color-base-400: color-mix(in oklch, var(--sf-color-base) 65%, var(--sf-color-base));
+    --sf-color-base-100: color-mix(in oklch, var(--sf-color-base)  8%, var(--sf-color-text));
+    --sf-color-base-200: color-mix(in oklch, var(--sf-color-base) 20%, var(--sf-color-text));
+    --sf-color-base-300: color-mix(in oklch, var(--sf-color-base) 40%, var(--sf-color-text));
+    --sf-color-base-400: color-mix(in oklch, var(--sf-color-base) 65%, var(--sf-color-text));
📝 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
--sf-color-base-100: color-mix(in oklch, var(--sf-color-base) 8%, var(--sf-color-base));
--sf-color-base-200: color-mix(in oklch, var(--sf-color-base) 20%, var(--sf-color-base));
--sf-color-base-300: color-mix(in oklch, var(--sf-color-base) 40%, var(--sf-color-base));
--sf-color-base-400: color-mix(in oklch, var(--sf-color-base) 65%, var(--sf-color-base));
--sf-color-base-100: color-mix(in oklch, var(--sf-color-base) 8%, var(--sf-color-text));
--sf-color-base-200: color-mix(in oklch, var(--sf-color-base) 20%, var(--sf-color-text));
--sf-color-base-300: color-mix(in oklch, var(--sf-color-base) 40%, var(--sf-color-text));
--sf-color-base-400: color-mix(in oklch, var(--sf-color-base) 65%, var(--sf-color-text));
🤖 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 `@optional/tokens.palette.css` around lines 115 - 118, The four base tint
tokens (--sf-color-base-100, --sf-color-base-200, --sf-color-base-300,
--sf-color-base-400) currently mix var(--sf-color-base) with itself which
collapses to a single value; change the second operand to var(--sf-color-text)
so the scale ramps from base toward text (i.e., use color-mix(in oklch,
var(--sf-color-text) <percent>, var(--sf-color-base)) and keep the intended
percentages (8%, 20%, 40%, 65%) so each token progressively shifts from the base
color toward the text color).

jackgranatowski pushed a commit that referenced this pull request May 20, 2026
--sf-color-base-100 through -400 were mixing var(--sf-color-base)
with itself, producing no scale (all values equal to base).

Fix: mix var(--sf-color-text) into var(--sf-color-base) at increasing
percentages (8%→65%), creating a grayscale that steps from near-base
toward text — consistent with the shade scale (600–900) and theme-aware
in both light and dark mode.

Caught by CodeRabbit review on PR #25.

https://claude.ai/code/session_015xq1jY8LgWAuyKQJmCM8L7
@jackgranatowski
jackgranatowski merged commit 26658d5 into main May 20, 2026
3 checks passed
@jackgranatowski
jackgranatowski deleted the feat/color-system-dx-improvement branch May 31, 2026 17:59
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.

fix(palette): tints/shades mix with theme-aware tokens instead of literal white/black

2 participants