Skip to content

Comments module fails to detect dark mode if parent color is defined as oklch #24906

@christopher-b

Description

@christopher-b

Issue Summary

In a Ghost theme, the Comments module ({{comments}}) has the ability to detect if it should render in dark mode. It does this by reading the color CSS property of its parent container. However, it assumes that this property is defined as an RGB value. If the color is defined as OKLCH (or other notations, presumably), it will fail to detect the correct color context and default to "light mode".

The problem is here: we expect the color property to be a comma-separated list representing RGB values.

Steps to Reproduce

  1. In your theme, apply an OKLCH color to the parent of the {{comments}} module:
<div style="color:oklch(1 0 0);">
  {{comments}}
</div>

Since oklch(1 0 0) should produce white text, we expect comments to render in dark mode, but they do not.
If we change the color value to #ffffff, comments are rendered in dark mode as expected.

Ghost Version

6.0.9

Node.js Version

22.13.1

How did you install Ghost?

ghost CLI on MacOS

Database type

MySQL 5.7

Browser & OS version

Firefox 142, Chrome 140

Relevant log / error output

Code of Conduct

  • I agree to be friendly and polite to people in this repository

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug[triage] something behaving unexpectedly

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions