# 我如何在彩色背景上强制设置文本颜色

**URL:** https://meta.discourse.org/t/how-do-i-force-the-text-color-on-a-colored-background/149509
**Category:** Development
**Created:** [2020年四月27日 19:32 UTC](https://meta.discourse.org/t/how-do-i-force-the-text-color-on-a-colored-background/149509 "2020-04-27T19:32:19Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [2020年四月27日 19:32 UTC](https://meta.discourse.org/t/how-do-i-force-the-text-color-on-a-colored-background/149509/1 "2020-04-27T19:32:19Z")

</div>

您好。  
我尝试创建一个主题，我的主题颜色显示如下：

![image](https://global.discourse-cdn.com/meta/original/3X/c/8/c86b2f23d298c9126504f49c803384208a27e3bf.png)  
我希望在所有使用此蓝色背景的元素上显示白色文字，而不是 Discourse 选择的黑色文字。  
在哪里可以强制将文字设为白色？

编辑：我读过这篇文章：

> [@Override values for auto-generated color variables](https://meta.discourse.org/t/override-values-for-auto-generated-color-variables/134374):
>
> As of v2.3.3 (released early September) you can now override our automatically-generated SASS color variables ($primary-low, $primary-medium, etc) in remote themes (you can not yet do this directly via the admin UI.) To override one of these colors you need to add it to the color\_scheme section of your theme’s about.json file. Once you’ve done that you can see the override listed within your color scheme in /admin/customize/colors. "color\_schemes": { “My\_colors”: { "primary": "000000…

我正在主题创建器中创建主题，我认为我无法访问 about.json？

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [2020年四月27日 20:14 UTC](https://meta.discourse.org/t/how-do-i-force-the-text-color-on-a-colored-background/149509/2 "2020-04-27T20:14:44Z")

</div>

> [@Canapin](#):
>
> 我希望在所有使用此蓝色背景的元素上使用白色文字。

我认为无法通过一个简单的更改在所有地方实现这一目标。更改的复杂程度取决于涉及的是哪个变量……是次要、三级还是四级变量？

> [@Canapin](#):
>
> 我正在主题创建器中创建主题，我认为我无法访问 about.json？

是的，您无法直接在主题创建器网站上编辑 `about.json`，但您可以按照本指南通过 Git 设置主题：[https://meta.discourse.org/t/beginners-guide-to-using-theme-creator-and-theme-cli-to-start-building-a-discourse-theme/108444。](https://meta.discourse.org/t/beginners-guide-to-using-theme-creator-and-theme-cli-to-start-building-a-discourse-theme/108444%E3%80%82)

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [2020年四月27日 20:18 UTC](https://meta.discourse.org/t/how-do-i-force-the-text-color-on-a-colored-background/149509/3 "2020-04-27T20:18:49Z")

</div>

目前正在处理，谢谢！

这是 $tertiary 和 $quaternary。
