# Brand Filtering

Each brand has its own filter that determines which color tokens are included in the output CSS. Filters are defined in `packages/css/src/style-dictionary/filters.ts`.

## Theme filtering

All brands include the `base` and `dark` theme variants, which map to `:root` and `.dark` CSS selectors respectively. The `desktop`, `tablet`, and `mobile` variants are duplicates and are excluded.

## Mindvalley

Filter name: `mindvalley-colors`

| Setting | Value |
| --- | --- |
| Allowed subcategories | `accent`, `colors` |
| Theme subcategories | `backgrounds`, `components`, `content`, `stroke` |
| Numbered scale required | `colors` subcategory only |
| Grey group exception | Yes — allows non-numbered tokens like `black`, `white` |
| Excluded color groups | None |
| Excluded output tokens | None |

**Base layer** (`accent`, `colors`): All color families (blue, green, purple, etc.) with their full 50–900 numbered scales, plus accent tokens (alpha variants like `black-50a`, `white-12a`), and the special `black`/`white` base colors from the grey group.

**Theme layer** (`backgrounds`, `components`, `content`, `stroke`): Semantic tokens that pass through with no numbered-scale filtering. These tokens reference base-layer variables and have different values in light vs dark mode.

## B2B

Filter name: `b2b-colors`

| Setting | Value |
| --- | --- |
| Allowed subcategories | `accent`, `primary`, `secondary` |
| Theme subcategories | `button` |
| Numbered scale required | `primary`, `secondary` subcategories |
| Grey group exception | No |
| Excluded color groups | `black`, `white` |
| Excluded output tokens | `purple-500-20a`, `purple-500-90a`, `purple-600-10a`, `purple-tint` |

**Base layer** (`accent`, `primary`, `secondary`): B2B-specific color palette with brown, dark-brown accent tokens and primary purple/blue/brown plus secondary red/teal numbered scales. Excludes certain Mindvalley-specific accent tokens.

**Theme layer** (`button`): Button-specific semantic tokens (filled brand, filled neutral, hover states).

## How filtering works

The filter logic follows these steps for each token:

1. Check if the token is a color type
2. Check if the theme is `base` or `dark`
3. If the subcategory is a theme subcategory — pass through (no further filtering)
4. Check if the subcategory is in the allowed list
5. Check if the color group is not excluded
6. Check if the output token name is not excluded
7. For numbered-scale subcategories, check if the token name is a number (e.g., `50`, `100`)
8. Apply grey group exception if configured (allows `black`, `white` through step 7)
