# 活动摘要邮件在“为你推荐”中不再显示类别颜色

**URL:** <https://meta.discourse.org/t/activity-summary-emails-no-longer-show-colour-of-category-in-new-for-you/293160>\
**Category:** Bug\
**Tags:** activity-summary\
**Created:** [2024年一月27日 20:41 UTC](https://meta.discourse.org/t/activity-summary-emails-no-longer-show-colour-of-category-in-new-for-you/293160 "2024-01-27T20:41:15Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![AstonJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/astonj/32/215041_2.png) [@AstonJ](https://meta.discourse.org/u/AstonJ)\
**Post date:** [2024年一月27日 20:41 UTC](https://meta.discourse.org/t/activity-summary-emails-no-longer-show-colour-of-category-in-new-for-you/293160/1 "2024-01-27T20:41:16Z")

</div>

摘要过去会在“新为你”中显示链接所属类别的颜色，但现在不再显示了——有什么办法可以恢复吗？

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [2024年一月29日 05:13 UTC](https://meta.discourse.org/t/activity-summary-emails-no-longer-show-colour-of-category-in-new-for-you/293160/2 "2024-01-29T05:13:23Z")

</div>

你能包含一张你所说的截图吗？

---

<div class="post-metadata">

**Author:** ![AstonJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/astonj/32/215041_2.png) [@AstonJ](https://meta.discourse.org/u/AstonJ)\
**Post date:** [2024年一月29日 21:01 UTC](https://meta.discourse.org/t/activity-summary-emails-no-longer-show-colour-of-category-in-new-for-you/293160/3 "2024-01-29T21:01:05Z")

</div>

它基本上是链接的颜色（反映了类别颜色），无论链接出现在哪里。对于使用默认样式的用户，它会显示一个小条，对于使用框样式的用户，链接文本将显示为类别的颜色。

这是它现在显示的样子：

 ![Screenshot 2024-01-29 at 20.47.27](https://global.discourse-cdn.com/meta/original/4X/6/7/e/67e574d6696f2332be2bb5246bc743008fa1d433.png)

 ![Screenshot 2024-01-29 at 20.52.49](https://global.discourse-cdn.com/meta/original/4X/a/5/8/a586136a0ecec5bb079f56cc2f384ec06577945a.png)

对于使用默认条的用户，它本应显示如下：

 ![Screenshot 2024-01-29 at 20.53.26](https://global.discourse-cdn.com/meta/original/4X/8/d/e/8dec2330ab04dd72b88f5093d6b0ad9d7f275234.png)

 ![Screenshot 2024-01-29 at 20.47.35](https://global.discourse-cdn.com/meta/original/4X/e/5/1/e51c78f2afe83bf1977a464801c04f4000101357.png)

对于所有使用框样式用户，它将显示类别名称/链接的颜色为类别颜色（这就是我希望看到的）：

 ![Screenshot 2024-01-29 at 20.57.56](https://global.discourse-cdn.com/meta/original/4X/3/4/9/3492c80451fd35aec8f63bcfed96e3851f104082.png)

 ![Screenshot 2024-01-29 at 21.00.11](https://global.discourse-cdn.com/meta/original/4X/0/c/2/0c2667281a90718bf7a0d1ae32fe2919544afb39.png)

---

<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:** [2024年一月29日 22:31 UTC](https://meta.discourse.org/t/activity-summary-emails-no-longer-show-colour-of-category-in-new-for-you/293160/6 "2024-01-29T22:31:34Z")

</div>

啊，我明白了……不幸的是，我们创建类别徽章的新方法（CSS 自定义属性和伪选择器）不被电子邮件客户端支持。我们需要为电子邮件单独做些什么 🤔

---

<div class="post-metadata">

**Author:** ![AstonJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/astonj/32/215041_2.png) [@AstonJ](https://meta.discourse.org/u/AstonJ)\
**Post date:** [2024年一月30日 00:09 UTC](https://meta.discourse.org/t/activity-summary-emails-no-longer-show-colour-of-category-in-new-for-you/293160/7 "2024-01-30T00:09:03Z")

</div>

谢谢 Kris。您能否按照下面的绿色示例添加 `color`？（其中绿色是类别颜色）

```plaintext
Style Attribute {
--category-badge-color: #1ac831;
--category-badge-text-color: #FFFFFF;
--parent-category-badge-color: #1ac831;
color: green;
}

```

您能否在以下位置也做同样的事情：[Category Badge Styles - #2 by AstonJ](https://meta.discourse.org/t/category-badge-styles/285320/2?u=astonj%EF%BC%9F)

---

<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:** [2024年一月30日 23:26 UTC](https://meta.discourse.org/t/activity-summary-emails-no-longer-show-colour-of-category-in-new-for-you/293160/8 "2024-01-30T23:26:50Z")

</div>

我有一个正在进行的 PR 来为电子邮件内联样式

> <https://github.com/discourse/discourse/pull/25487>
>
> Reported here: https://meta.discourse.org/t/activity-summary-emails-no-longer-sh…ow-colour-of-category-in-new-for-you/293160
> 
> Follow-up to this change: https://github.com/discourse/discourse/pull/24198
> 
> We started rendering category badge styles using CSS custom properties on a :before pseudo element. This is not compatible with email clients. So the solution is to render these styles inline in the email instead. 
> 
> I've created a new \`email\_category\_badge\` helper for these cases. 
> 
> Before (General and Arts & Media are missing the category badge and text color):
> !\[Screenshot 2024-01-30 at 2 06 51 PM\](https://github.com/discourse/discourse/assets/1681963/510e79b2-e3f4-4b29-92c1-49561607e0bf)
> 
> After (Badge returns, and the text obeys the category setting): 
> 
> !\[Screenshot 2024-01-30 at 1 24 11 PM\](https://github.com/discourse/discourse/assets/1681963/9915f0e9-b9c3-421a-8850-d1c9b4726544)

但我们正在完成最新的版本，所以审查和合并可能需要比平时更长的时间

---

<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:** [2024年二月9日 20:30 UTC](https://meta.discourse.org/t/activity-summary-emails-no-longer-show-colour-of-category-in-new-for-you/293160/9 "2024-02-09T20:30:00Z")

</div>

我已经合并了修复程序，所以下次您更新 Discourse 时，电子邮件应该会再次显示徽章颜色！

---

<div class="post-metadata">

**Author:** ![AstonJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/astonj/32/215041_2.png) [@AstonJ](https://meta.discourse.org/u/AstonJ)\
**Post date:** [2024年二月11日 23:30 UTC](https://meta.discourse.org/t/activity-summary-emails-no-longer-show-colour-of-category-in-new-for-you/293160/11 "2024-02-11T23:30:49Z")

</div>

谢谢 Kris，但现在文本是白色的/没有显示框类别样式，如：

> [@Category Badge Styles](https://meta.discourse.org/t/category-badge-styles/285320):
>
> discourse2Summary Category Badge Styles replaces the functionality of the deprecated category\_style admin settingeyeglassesPreview [Preview on Discourse Theme Creator](https://discourse.theme-creator.io/theme/Discourse/category-badge-style-box) (box) [Preview on Discourse Theme Creator](https://discourse.theme-creator.io/theme/Discourse/category-badge-style-bar) (bar)hammer_and_wrenchRepository [https://github.com/discourse/discourse-category-badge-styles](https://github.com/discourse/discourse-category-badge-styles)questionInstall Guide [How to install a theme or theme component](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682) Install this theme component Features With the changes to the category\_style admin setting, th…

---

<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:** [2024年二月12日 23:02 UTC](https://meta.discourse.org/t/activity-summary-emails-no-longer-show-colour-of-category-in-new-for-you/293160/12 "2024-02-12T23:02:37Z")

</div>

> [@AstonJ](#):
>
> 未显示框类别样式

遗憾的是，主题组件无法更改电子邮件样式，我们也不再支持框样式。

不过我倒是意识到，我们不再为 Discourse 中的默认类别徽章使用文本颜色类别设置（它仅用于您链接的主题组件中），但在更新电子邮件时，我包含了一些将使用它的 CSS……这就是为什么您的类别在电子邮件中显示为白色文本的原因。为了与默认类别徽章保持一致，我应该删除它。

---

<div class="post-metadata">

**Author:** ![AstonJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/astonj/32/215041_2.png) [@AstonJ](https://meta.discourse.org/u/AstonJ)\
**Post date:** [2024年二月15日 05:23 UTC](https://meta.discourse.org/t/activity-summary-emails-no-longer-show-colour-of-category-in-new-for-you/293160/15 "2024-02-15T05:23:30Z")

</div>

另一个问题……在另一个论坛上，所有类别的背景颜色都是白色的（我们使用前景色作为区分器）：

 ![Screenshot 2024-02-15 at 05.20.02](https://global.discourse-cdn.com/meta/original/4X/7/5/5/7553bf45bbaf300e45aebf88f96d4989b2a87df6.png)

所以现在在摘要中，所有的条形都显示为白色，所有的文本都是蓝色的（论坛的主要颜色）。

也许“类别设置”页面需要额外的字段来指定它们在电子邮件等地方应该如何显示？或者也许应该恢复[框](https://meta.discourse.org/t/moving-to-a-single-category-style-site-setting/282441)因为它们提供了最大的灵活性？

---

<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:** [2024年二月15日 14:53 UTC](https://meta.discourse.org/t/activity-summary-emails-no-longer-show-colour-of-category-in-new-for-you/293160/16 "2024-02-15T14:53:59Z")

</div>

好的，我们不再支持将框样式类别作为 Discourse 的一项功能……因此，它并非在所有地方都能正常工作。可以通过 admin/customize/email\_style/… 添加自定义电子邮件样式。

例如，在此处添加类似内容，可以使电子邮件中的框样式更接近：

```scss
[data-category-id] {
  background: white;
  color: #333 !important;
  padding: 0 .25em;
  span > span { // hides the bullet category badge
    display: none !important;
  }
}

```

---

<div class="post-metadata">

**Author:** ![AstonJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/astonj/32/215041_2.png) [@AstonJ](https://meta.discourse.org/u/AstonJ)\
**Post date:** [2024年二月16日 01:10 UTC](https://meta.discourse.org/t/activity-summary-emails-no-longer-show-colour-of-category-in-new-for-you/293160/17 "2024-02-16T01:10:47Z")

</div>

谢谢 Kris。有什么方法可以在那里使用背景/前景类别颜色吗？在 vBulletin 等论坛平台中，您通常可以访问常用变量，以便在这些地方使用。

---

<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:** [2024年二月19日 13:00 UTC](https://meta.discourse.org/t/activity-summary-emails-no-longer-show-colour-of-category-in-new-for-you/293160/18 "2024-02-19T13:00:51Z")

</div>

此主题已在 9 天后自动关闭。不允许回复。
