TryGhost/Ghost

{{contrast_text_color}} helper returns incorrect text color

Open

#27,797 建立於 2026年5月9日

在 GitHub 查看
 (1 留言) (0 反應) (0 負責人)JavaScript (11,551 fork)batch import
bugcommunitygood first issue

倉庫指標

Star
 (52,799 star)
PR 合併指標
 (平均合併 19天 11小時) (30 天內合併 658 個 PR)

描述

Issue Summary

The {{contrast_text_color}} helper returns incorrect text color for many backgrounds due to a typo in textColorForBackgroundColor from @tryghost/color-utils.

Root cause

In @tryghost/color-utils the YIQ formula uses .b() instead of .blue():

Fix

PR submitted to TryGhost/SDK: https://github.com/TryGhost/SDK/pull/905

Steps to Reproduce

Use light color with the {{contrast_text_color}} helper — the returned contrast color will be white instead of black.

For example: #dacafe, #ffa5b1, #a3e6ff

Ghost Version

6.37.1

Node.js Version

v22.13.1

How did you install Ghost?

localhost

Database type

SQLite3

Browser & OS version

No response

Relevant log / error output

Code of Conduct

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

貢獻者指南