Skip to content

Fix dark mode hr colour to use CSS variable instead of color-mod#1041

Closed
jonhickman wants to merge 4 commits into
TryGhost:mainfrom
jonhickman:doitdoug-dev
Closed

Fix dark mode hr colour to use CSS variable instead of color-mod#1041
jonhickman wants to merge 4 commits into
TryGhost:mainfrom
jonhickman:doitdoug-dev

Conversation

@jonhickman
Copy link
Copy Markdown
Contributor

@jonhickman jonhickman commented Mar 30, 2026

Summary

  • Ghost users reported that the divider card (hr) in Ghost was not producing a visible divider in Casper, under Dark Mode
  • this is a similar issue and fix to Fix dark mode secondary text colour broken by postcss-color-mod-function v4 #1040 which improved color contrast for post metadata
  • Replaces color-mod(var(--color-darkmode) l(+8%)) with var(--color-secondary-text) for hr border and background in dark mode
  • Consistent with how secondary text colours are handled elsewhere in the theme

Before

CleanShot 2026-03-30 at 08 50 41@2x

After

CleanShot 2026-03-30 at 08 50 09@2x

…ction v4

The color-mod(var(--color-secondary-text) l(-22%)) value compiled to
#000 after postcss-color-mod-function was bumped from v3 to v4, making
tags, post meta, byline and pagination text invisible on dark backgrounds.

Replace with var(--color-secondary-text) directly. #979797 gives ~4.6:1
contrast on the dark mode background and sits correctly below the #fff
primary text in the visual hierarchy. Same fix applied to the auto-color
media query variant.
gulp-zip v6 switched to a named export. Update require() to use .default
to restore the zip build task.
Replace color-mod(var(--color-darkmode) l(+8%)) with var(--color-secondary-text) for hr border and background in dark mode, consistent with how other secondary text colours are handled.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 30, 2026

Walkthrough

This PR updates CSS styling for dark-mode and auto-color theme variants. The minified assets/built/screen.css is regenerated with no functional rule changes. The source assets/css/screen.css simplifies color calculations by replacing color-mod() functions (which performed lightness adjustments) with direct CSS variable references. Changes affect dark-mode styling for post card tags, meta information, article tags, byline content, and pagination elements, where secondary text color values are updated.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: fixing dark mode hr color by replacing color-mod with a CSS variable, which matches the core objective of the PR.
Description check ✅ Passed The description is directly related to the changeset, explaining the bug (invisible hr in dark mode), the solution (replacing color-mod with var(--color-secondary-text)), and including before/after screenshots demonstrating the fix.
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
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch doitdoug-dev

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.

@jonhickman jonhickman marked this pull request as ready for review March 30, 2026 07:52
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@assets/css/screen.css`:
- Around line 2279-2285: The auto-color dark-scheme HR rules still use
color-mod(...) and should mirror the explicit dark-mode rules: update the
selectors html.auto-color hr and html.auto-color .gh-content hr:after to use
var(--color-secondary-text) for border-top-color/background and use box-shadow:
var(--color-darkmode) 0 0 0 5px for the after element, replacing any
color-mod(...) expressions so auto-color users get the same high-contrast
divider as html.dark-mode.
🪄 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

Run ID: e3702c7d-1a68-4ff1-ab78-26f68a61482e

📥 Commits

Reviewing files that changed from the base of the PR and between 24e244e and f08e3aa.

⛔ Files ignored due to path filters (1)
  • assets/built/screen.css.map is excluded by !**/*.map
📒 Files selected for processing (2)
  • assets/built/screen.css
  • assets/css/screen.css

Comment thread assets/css/screen.css
Comment on lines 2279 to 2285
html.dark-mode hr {
border-top-color: color-mod(var(--color-darkmode) l(+8%));
border-top-color: var(--color-secondary-text);
}

html.dark-mode .gh-content hr:after {
background: color-mod(var(--color-darkmode) l(+8%));
background: var(--color-secondary-text);
box-shadow: var(--color-darkmode) 0 0 0 5px;
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

Mirror the HR fix in html.auto-color dark-scheme rules.

Line 2280 and Line 2284 fix explicit dark mode, but the equivalent @media (prefers-color-scheme: dark) html.auto-color HR rules still use color-mod(...), so the divider can remain too low-contrast for auto-color users.

🔧 Proposed fix
@@
-    html.auto-color hr {
-        border-top-color: color-mod(var(--color-darkmode) l(+8%));
-    }
+    html.auto-color hr {
+        border-top-color: var(--color-secondary-text);
+    }

@@
-    html.auto-color .gh-content hr:after {
-        background: color-mod(var(--color-darkmode) l(+8%));
+    html.auto-color .gh-content hr:after {
+        background: var(--color-secondary-text);
         box-shadow: var(--color-darkmode) 0 0 0 5px;
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@assets/css/screen.css` around lines 2279 - 2285, The auto-color dark-scheme
HR rules still use color-mod(...) and should mirror the explicit dark-mode
rules: update the selectors html.auto-color hr and html.auto-color .gh-content
hr:after to use var(--color-secondary-text) for border-top-color/background and
use box-shadow: var(--color-darkmode) 0 0 0 5px for the after element, replacing
any color-mod(...) expressions so auto-color users get the same high-contrast
divider as html.dark-mode.

@jonhickman
Copy link
Copy Markdown
Contributor Author

Closing in favour of a cleaner branch — will reopen shortly.

@jonhickman jonhickman closed this Mar 30, 2026
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.

1 participant