CSS classes for current user's groups

This theme component adds the groups that a member is a part of as CSS classes on the <body> tag.

Before:

image

After:

Discourse only adds the current user’s primary group as a CSS class by default. This component changes that so that all of the groups that the current user is a member of are added as classes - including the built-in ones like trust-level.

The component takes each group name and adds it as a CSS class like so

group-NAME

Once you install and activate this theme component, you can add CSS to your theme that targets specific groups like so

.group-NAME {
  .some-selector {
    color: red;
  }
}
16 Likes