# 我正在使用的这个主题是根据其他颜色计算背景的，即使使用 CSS Component 也无法让我选择特定颜色

**URL:** <https://meta.discourse.org/t/the-theme-im-using-calculates-the-background-based-off-of-other-colors-and-wont-let-me-pick-a-specific-color-even-with-css-component/386840>\
**Category:** Support\
**Tags:** css\
**Created:** [2025年十月27日 16:28 UTC](https://meta.discourse.org/t/the-theme-im-using-calculates-the-background-based-off-of-other-colors-and-wont-let-me-pick-a-specific-color-even-with-css-component/386840 "2025-10-27T16:28:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jack\_McCarthy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jack_mccarthy/32/487139_2.png) [@Jack\_McCarthy](https://meta.discourse.org/u/Jack_McCarthy)\
**Post date:** [2025年十月27日 16:28 UTC](https://meta.discourse.org/t/the-theme-im-using-calculates-the-background-based-off-of-other-colors-and-wont-let-me-pick-a-specific-color-even-with-css-component/386840/1 "2025-10-27T16:28:33Z")

</div>

我正在使用 Horizon 主题，该主题没有直接选择背景颜色的方法。检查器中显示的内容如下：

`html { –background-color: light-dark( oklch(from #002F43 96% calc(c \* 0.125) h), oklch(from #002F43 10% 0.025 h) ) !important; }`

我尝试在 CSS 组件中定义 --background-color，但它不起作用，我在检查器中发现我的代码被划掉了：

 ![Screenshot 2025-10-27 121344](https://global.discourse-cdn.com/meta/original/4X/8/b/1/8b103850cd90d8641c12a8085a22ddddb6b68ae0.png)

如何在不被主题覆盖的情况下设置特定的背景颜色？

编辑：我通过在我的 CSS 语句末尾添加“!important”找到了解决方案。

---

<div class="post-metadata">

**Author:** ![HAWK](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hawk/32/86627_2.png) [@HAWK](https://meta.discourse.org/u/HAWK)\
**Post date:** [2025年十月28日 00:24 UTC](https://meta.discourse.org/t/the-theme-im-using-calculates-the-background-based-off-of-other-colors-and-wont-let-me-pick-a-specific-color-even-with-css-component/386840/2 "2025-10-28T00:24:34Z")

</div>


