丰富多彩的类别

:discourse2: Summary Colorful Categories uses each category’s colors in more places when you’re on a category topic list or within a topic.
:eyeglasses: Preview Preview on Discourse Theme Creator
:hammer_and_wrench: Repository Link https://github.com/discourse/discourse-colorful-categories
:open_book: New to Discourse Themes? Beginner’s guide to using Discourse Themes

Install this theme component

Features

Colorful Categories uses each category’s colors in more places when you’re on a category topic list or within a topic; the header, reply/create buttons, topic timeline, and the composer.

The composer’s colors will change based on the selected category:

Kapture 2021-10-27 at 11.47.15

Settings

Each of the color changes mentioned above can be disabled in the theme’s settings.

Name Description
use category color in composer disable to use default composer colors
use category color in header disable to use default header colors
use category color in timeline disable to use default topic timeline colors
use category color in buttons disable to use default button colors

Development Notes

You can disable all of the settings if you’d like to use this component as a way to make category colors reusable as css custom properties. For example, every category page and topic will have these properties set:

  --category-color
  --category-text-color

and the composer will get:

  --composer-category-text-color
  --composer-category-color

These can be reused wherever you’d like in your own CSS, for example:

body {
  background: var(--category-color); 
}

There are some defaults set when a category isn’t present, which you can change in your own CSS:

:root {
  --composer-category-text-color: var(--secondary);
  --composer-category-color: var(--tertiary);
  --category-color: var(--secondary);
  --category-text-color: var(--primary-low-mid);
}

:discourse2: Hosted by us? Theme components are available to use on our Standard, Business, and Enterprise plans.

40 个赞

我真的很喜欢这个主题组件,它能让你清楚地知道自己在哪一类。看起来当安装这个主题组件时,一些按钮的间距会发生变化。

安装主题组件后:

未安装主题组件时:

2 个赞

@awesomerobot 这是一个非常酷的组件,而且似乎目前有些被忽视!

昨天,我们在 Discourse for Teams 实例中遇到了一种情况,这种情况可能很有帮助。(Discourse for Teams…团队…如果你在听,请添加这个主题组件!)

  • 我们有许多类别的权限仅限于特定组。
  • 有时可能会在其中共享敏感信息。
  • 如果有人不小心,他们可能会选择错误的类别,并在没有意识到的情况下将内容发布到一个限制性较小的类别中。
    • 更糟糕的是,如果有自动发布触发器(例如发送到 Slack),在有机会移动帖子之前,内容就可能泄露出去。
      • 是的,这确实发生在我们身上了。

拥有一个强烈的视觉指示器来表明内容将发送到何处将非常有帮助。

我甚至可以进一步建议这个(或这个的另一个版本)插件应该关于“类别上下文”。也许一个额外的功能是类别名称也会附加到操作按钮上。请看下面:

2 个赞

非常感谢您分享这个隐藏的瑰宝。到目前为止我很喜欢它 @awesomerobot

不过,我在菜单标题上遇到一个小问题。它的颜色会随着“创建新主题”的类别颜色而改变。我尝试了不同的主题,它们都存在同样的问题。

有什么办法可以只更改类别颜色,同时保持菜单标题的颜色不变吗?
Link

1 个赞

我刚处理了一个实例,其中某些类别的颜色未被拾取(并在控制台中记录)。花了我一些时间才找到根本原因,但似乎是类别设置页面上的过滤器设置 no subcategories 而不是 all topics

Screenshot from 2022-06-21 23-11-55

选择此设置会将 /none 添加到类别 URL。这似乎会干扰颜色选择。

今天刚添加的,看起来很棒 :smiley:

但是,每次我点击一个主题时,我都会在类别名称旁边看到一个白色方块。然后我意识到那是类别颜色,但显示这个方块似乎毫无意义,因为整个类别颜色都显示在标题中。

没有 TC image
有 TC image

(TC = 主题组件)

2 个赞

各位早上好,在今天的更新之后,这里有些东西破坏了 cat+topics 视图中的类别边框颜色。有人能确认一下吗?

image

1 个赞

我也遇到了这个问题,在使用 Material 主题时。

此问题与该组件无关,并且已修复:

添加类别选择器怎么样?

我想在几个_已订阅_的类别中启用它(也可以通过信任级别实现):slight_smile:

我注意到消息中“回复主题”按钮的颜色和时间线手柄与背景相同。它们都是白底白字。

控制台中还有一个弃用通知

[THEME 5601 ‘Colorful categories’] 弃用通知:从 discourse-common/lib/get-owner 导入 getOwner 已弃用。请使用 import { getOwner } from '@ember/application',或者如果您仍需要回退 shim,请使用 import { getOwnerWithFallback } from 'discourse-common/lib/get-owner';。[自 Discourse 3.2 起弃用] [弃用 ID: discourse.get-owner-with-fallback]

并且侧边栏切换按钮不像搜索图标那样改变颜色。

image

2 个赞

组件可能需要更新

3 个赞

我认为这个应该没问题 :rocket:

我一直在检查我们的 all-the-pluginsall-the-themes 目录,试图提前识别受影响的主题/插件。我们正在努力更新官方的插件,并且我已经给可能受影响的开源第三方插件的作者发送了私信 :writing_hand:

5 个赞