# 颜色调色板设置未被反映

**URL:** <https://meta.discourse.org/t/color-palette-settings-are-not-being-reflected/349034>\
**Category:** Development\
**Created:** [2025年一月26日 05:41 UTC](https://meta.discourse.org/t/color-palette-settings-are-not-being-reflected/349034 "2025-01-26T05:41:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mk0r](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@mk0r](https://meta.discourse.org/u/mk0r)\
**Post date:** [2025年一月26日 05:41 UTC](https://meta.discourse.org/t/color-palette-settings-are-not-being-reflected/349034/1 "2025-01-26T05:41:25Z")

</div>

我有一个新的 discourse 安装，并为新主题创建了脚手架。首先，我编辑了配色方案，使用了名为 Flexoki 的方案。您可以在此处查看：

> <https://github.com/m1chaeljmk/psychomotor-theme/blob/main/about.json>

我已经通过 GitHub 在我的 discourse 实例中添加并选择了该主题，但没有任何颜色设置得到反映，而是我只看到了 Flexoki Light 和 Dark 的默认颜色。有什么故障排除的帮助吗？

 ![Screenshot 2025-01-25 at 21.40.35](https://global.discourse-cdn.com/meta/original/4X/9/c/4/9c47989b7f4007338f3d74c47d78ba7ad86d4e56.png)

---

<div class="post-metadata">

**Author:** ![traceymoko](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/traceymoko/32/483235_2.png) [@traceymoko](https://meta.discourse.org/u/traceymoko)\
**Post date:** [2025年一月26日 06:28 UTC](https://meta.discourse.org/t/color-palette-settings-are-not-being-reflected/349034/2 "2025-01-26T06:28:26Z")

</div>

是的，首先有几件事需要检查：

1. 确保您的主题选择了特定的配色方案：

 ![The image shows a settings page for a website theme customization with options for background image upload, color palette selection, and theme visibility. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/6/1/b/61bc036c87fcfc5224dded8ef2a068c362eb9543.png)

1. 如果该设置正确但仍显示错误的配色方案，请确保您的个人资料设置未选择错误的配色方案：

 ![The image shows a user interface with options for changing the color palette and theme settings, including a note about previewing dark mode on a device where dark mode is enabled. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/e/3/5/e3530f16268ed05a7f1feda105a5a3ad7bfa538d.jpeg)

---

<div class="post-metadata">

**Author:** ![mk0r](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@mk0r](https://meta.discourse.org/u/mk0r)\
**Post date:** [2025年一月26日 07:28 UTC](https://meta.discourse.org/t/color-palette-settings-are-not-being-reflected/349034/3 "2025-01-26T07:28:10Z")

</div>

谢谢，这两个都不是问题。正如截图所示，用户界面显示 flexoki 主题只是默认的 discourse 颜色。不知何故，调色板根本没有被解析。

---

<div class="post-metadata">

**Author:** ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)\
**Post date:** [2025年一月26日 07:52 UTC](https://meta.discourse.org/t/color-palette-settings-are-not-being-reflected/349034/4 "2025-01-26T07:52:34Z")

</div>

我可能看错了。但来回切换时，看起来你上传的配色方案是 Light 的复制品

 ![图片显示了两个名为“Light”和“Flexoki Light”的浅色系统之间的配色方案对比，每个系统都由黑白矩形以及不同组合的蓝色、红色、黄色、绿色、粉色和浅蓝色组成。(AI 标注)](https://global.discourse-cdn.com/meta/original/4X/7/4/5/745e0fa059094c52d08c47551963156349a0073f.png)

前往 #Customization > Theme，选择一个外观不同的配色方案，然后尝试切换到该配色方案。

---

<div class="post-metadata">

**Author:** ![traceymoko](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/traceymoko/32/483235_2.png) [@traceymoko](https://meta.discourse.org/u/traceymoko)\
**Post date:** [2025年一月26日 08:47 UTC](https://meta.discourse.org/t/color-palette-settings-are-not-being-reflected/349034/5 "2025-01-26T08:47:40Z")

</div>

> [@mk0r](#):
>
> 不知何故，调色板根本没有被解析

啊，我现在明白了你的意思。所以 Discourse 没有读取这些颜色：

```plaintext
"color_schemes": {
    "Flexoki Light": {
      "primary": "#100F0F",
      "secondary": "#FFFCF0",
      "tertiary": "#205EA6",
      "quaternary": "#AF3029",
      "header_background": "#F2F0E5",
      "header_primary": "#6F6E69",
      "highlight": "#ECCB60",
      "danger": "#AF3029",

```

> [@Heliosurge](#):
>
> 但是来回移动，看起来你上传的调色板是浅色系的副本

问题出在上面——它没有使用文件中列出的颜色^^

---

<div class="post-metadata">

**Author:** ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)\
**Post date:** [2025年一月26日 08:53 UTC](https://meta.discourse.org/t/color-palette-settings-are-not-being-reflected/349034/6 "2025-01-26T08:53:38Z")

</div>

文件布局是否存在问题？导致其默认设置？

最好直接在 Discourse 中创建新的配色方案并输入这些值，而不是导入主题。

---

<div class="post-metadata">

**Author:** ![traceymoko](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/traceymoko/32/483235_2.png) [@traceymoko](https://meta.discourse.org/u/traceymoko)\
**Post date:** [2025年一月26日 08:54 UTC](https://meta.discourse.org/t/color-palette-settings-are-not-being-reflected/349034/7 "2025-01-26T08:54:48Z")

</div>

我查看了文件的语法。在我以前的调色板方案中，每个十六进制字符串都没有 `#`。

> <https://github.com/tracey-le/arctic-sunrise-theme/blob/35a5ad6e5cdb29ac635bccd144aeb9654651eef4/about.json#L14>

如果您将每个十六进制字符串更改为不以 `#` 开头，我认为它可能会正确解析。

> <https://github.com/m1chaeljmk/psychomotor-theme/blob/8bc747cb7c1ef9deb60ff06f67c6f6716f4c9151/about.json#L13>

Discourse 颜色方案的示例指南中也是如此：

> [@Create and share a color scheme](https://meta.discourse.org/t/create-and-share-a-color-scheme/61196#p-280569-fill-in-the-missing-information-in-your-aboutjson-file-5):
>
> Discourse now supports importing color schemes from remote repository. Here I will demonstrate how you would go about doing this. Navigate to colors and add a color scheme. Head to /admin/customize/colors on your site and create a color scheme. Tips: I used a chrome plugin ([color picker](https://chrome.google.com/webstore/detail/colorpick-eyedropper/ohcpnigalekghcmgcdcenkpelffpdolg?hl=en)) to select colors from an existing image of a palette on the web. If you create a theme, assign the color scheme to the theme and preview it, changes will be reflected live. Create a new gi…

```plaintext
{
   "name" : "Solarized",
   "about_url" : "https://github.com/SamSaffron/discourse-solarized",
   "license_url": "https://github.com/SamSaffron/discourse-solarized/blob/master/LICENSE",
   "color_schemes": {
      "Solarized Light": {
        "primary": "586E75",
        "secondary": "EEE8D5",
        "tertiary": "268BD2",
        "quaternary": "CB4B16",
        "header_background": "002B36",
        "header_primary": "93A1A1",
        "highlight": "B58900",
        "danger": "CB4B16",
        "success": "859900",
        "love": "DC322F"
      }
   }
}

```

---

<div class="post-metadata">

**Author:** ![mk0r](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@mk0r](https://meta.discourse.org/u/mk0r)\
**Post date:** [2025年一月26日 18:00 UTC](https://meta.discourse.org/t/color-palette-settings-are-not-being-reflected/349034/8 "2025-01-26T18:00:53Z")

</div>

啊！！谢谢！马上就试试这个修复方法，这看起来是正确的答案。
