Background Color โ
| Class Name | CSS Equivalent |
|---|---|
| background | background-color: rgba(var(--cds-sys-color-background), var(--cds-sys-background-opacity);; color: rgba(var(--cds-sys-color-on-background), var(--cds-sys-text-opacity); |
| surface | background-color: rgba(var(--cds-sys-color-surface), var(--cds-sys-background-opacity);; color: rgba(var(--cds-sys-color-on-surface), var(--cds-sys-text-opacity); |
| surface-container-highest | background-color: rgba(var(--cds-sys-color-surface-container-highest), var(--cds-sys-background-opacity);; color: rgba(var(--cds-sys-color-on-surface), var(--cds-sys-text-opacity); |
| surface-container-high | background-color: rgba(var(--cds-sys-color-surface-container-high), var(--cds-sys-background-opacity);; color: rgba(var(--cds-sys-color-on-surface), var(--cds-sys-text-opacity); |
| surface-container | background-color: rgba(var(--cds-sys-color-surface-container), var(--cds-sys-background-opacity);; color: rgba(var(--cds-sys-color-on-surface), var(--cds-sys-text-opacity); |
| surface-container-low | background-color: rgba(var(--cds-sys-color-surface-container-low), var(--cds-sys-background-opacity);; color: rgba(var(--cds-sys-color-on-surface), var(--cds-sys-text-opacity); |
| surface-container-lowest | background-color: rgba(var(--cds-sys-color-surface-container-lowest), var(--cds-sys-background-opacity);; color: rgba(var(--cds-sys-color-on-surface), var(--cds-sys-text-opacity); |
| bg-background | background-color: rgba(var(--cds-sys-color-bacground), var(--cds-sys-background-opacity); |
| bg-surface | background-color: rgba(var(--cds-sys-color-surface), var(--cds-sys-background-opacity); |
| bg-surface-container-highest | background-color: rgba(var(--cds-sys-color-surface-container-highest), var(--cds-sys-background-opacity); |
| bg-surface-container-high | background-color: rgba(var(--cds-sys-color-surface-container-high), var(--cds-sys-background-opacity); |
| bg-surface-container-low | background-color: rgba(var(--cds-sys-color-surface-container-low), var(--cds-sys-background-opacity); |
| bg-surface-container-lowest | background-color: rgba(var(--cds-sys-color-surface-container-lowest), var(--cds-sys-background-opacity); |
| primary | background-color: rgba(var(--cds-sys-color-primary), var(--cds-sys-background-opacity);; color: rgba(var(--cds-sys-color-on-primary), var(--cds-sys-text-opacity); |
| primary-container | background-color: rgba(var(--cds-sys-color-primary-container), var(--cds-sys-background-opacity);; color: rgba(var(--cds-sys-color-on-primary-container), var(--cds-sys-text-opacity); |
| bg-primary | background-color: rgba(var(--cds-sys-color-primary), var(--cds-sys-background-opacity); |
| bg-primary-container | background-color: rgba(var(--cds-sys-color-primary-container), var(--cds-sys-background-opacity); |
| primary-fixed | background-color: rgba(var(--cds-sys-color-primary-fixed), var(--cds-sys-background-opacity);; color: rgba(var(--cds-sys-color-on-primary), var(--cds-sys-text-opacity); |
| primary-fixed-dim | background-color: rgba(var(--cds-sys-color-primary-fixed-dim), var(--cds-sys-background-opacity);; color: rgba(var(--cds-sys-color-on-primary), var(--cds-sys-text-opacity); |
| bg-primary-fixed | background-color: rgba(var(--cds-sys-color-primary-fixed), var(--cds-sys-background-opacity); |
| bg-primary-fixed-variant | background-color: rgba(var(--cds-sys-color-primary-fixed-variant), var(--cds-sys-background-opacity); |
| secondary | background-color: rgba(var(--cds-sys-color-secondary), var(--cds-sys-background-opacity);; color: rgba(var(--cds-sys-color-on-secondary), var(--cds-sys-text-opacity); |
| secondary-container | background-color: rgba(var(--cds-sys-color-secondary-container), var(--cds-sys-background-opacity);; color: rgba(var(--cds-sys-color-on-secondary-container), var(--cds-sys-text-opacity); |
| bg-secondary | background-color: rgba(var(--cds-sys-color-secondary), var(--cds-sys-background-opacity); |
| bg-secondary-container | background-color: rgba(var(--cds-sys-color-secondary-container), var(--cds-sys-background-opacity); |
| secondary-fixed | background-color: rgba(var(--cds-sys-color-secondary-fixed), var(--cds-sys-background-opacity);; color: rgba(var(--cds-sys-color-on-secondary), var(--cds-sys-text-opacity); |
| secondary-fixed-dim | background-color: rgba(var(--cds-sys-color-secondary-fixed-dim), var(--cds-sys-background-opacity);; color: rgba(var(--cds-sys-color-on-secondary), var(--cds-sys-text-opacity); |
| bg-secondary-fixed | background-color: rgba(var(--cds-sys-color-secondary-fixed), var(--cds-sys-background-opacity); |
| bg-secondary-fixed-variant | background-color: rgba(var(--cds-sys-color-secondary-fixed-variant), var(--cds-sys-background-opacity); |
| error | background-color: rgba(var(--cds-sys-color-error), var(--cds-sys-background-opacity);; color: rgba(var(--cds-sys-color-on-error), var(--cds-sys-text-opacity); |
| error-container | background-color: rgba(var(--cds-sys-color-error-container), var(--cds-sys-background-opacity);; color: rgba(var(--cds-sys-color-on-error-container), var(--cds-sys-text-opacity); |
| bg-error | background-color: rgba(var(--cds-sys-color-error), var(--cds-sys-background-opacity); |
| success | background-color: rgba(var(--cds-sys-color-success), var(--cds-sys-background-opacity);; color: rgba(var(--cds-sys-color-on-success), var(--cds-sys-text-opacity); |
| success-container | background-color: rgba(var(--cds-sys-color-success-container), var(--cds-sys-background-opacity);; color: rgba(var(--cds-sys-color-on-success-container), var(--cds-sys-text-opacity); |
| bg-success | background-color: rgba(var(--cds-sys-color-success), var(--cds-sys-background-opacity); |
| warn | background-color: rgba(var(--cds-sys-color-warn), var(--cds-sys-background-opacity);; color: rgba(var(--cds-sys-color-on-warn), var(--cds-sys-text-opacity); |
| warn-container | background-color: rgba(var(--cds-sys-color-warn-container), var(--cds-sys-background-opacity);; color: rgba(var(--cds-sys-color-on-warn-container), var(--cds-sys-text-opacity); |
| bg-warn | background-color: rgba(var(--cds-sys-color-warn), var(--cds-sys-background-opacity); |
| excellent | background-color: rgba(var(--cds-sys-color-excellent), var(--cds-sys-background-opacity);; color: rgba(var(--cds-sys-color-on-excellent), var(--cds-sys-text-opacity); |
| excellent-container | background-color: rgba(var(--cds-sys-color-excellent-container), var(--cds-sys-background-opacity);; color: rgba(var(--cds-sys-color-on-excellent-container), var(--cds-sys-text-opacity); |
| bg-excellent | background-color: rgba(var(--cds-sys-color-excellent), var(--cds-sys-background-opacity); |
General Concepts โ
๐ก Some helpful-to-know words you'll see in the names of color roles:
- Surface: A role used for backgrounds and large, low-emphasis areas of the screen.
- Primary, Secondary : Accent color roles used to emphasize or de-emphasize foreground elements.
- Container: Roles used as a fill color for foreground elements like buttons. They should not be used for text or icons.
- On: Roles starting with this term indicate a color for text or icons on top of its paired parent color. For example,
on-primaryis used for text and icons against the primary fill color. - Variant: Roles ending with this term offer a lower emphasis alternative to its non-variant pair. For example,
on-surface-variantis a less emphasized version of the on-surface color.
1. Surface โ
Roles used for backgrounds and large, low-emphasis areas of the screen.
| Class Name | CSS Equivalent |
|---|---|
| background | background-color: rgba(var(--cds-sys-color-background), var(--cds-sys-bg-opacity)); color: rgba(var(--cds-sys-color-on-backround), var(--cds-sys-text-opacity)); |
| surface | background-color: rgba(var(--cds-sys-color-surface), var(--cds-sys-bg-opacity)); color: rgba(var(--cds-sys-color-on-surface), var(--cds-sys-text-opacity)); |
| surface-container-highest | background-color: rgba(var(--cds-sys-color-surface-container-highest), var(--cds-sys-bg-opacity)); color: rgba(var(--cds-sys-color-on-surface), var(--cds-sys-text-opacity)); |
| surface-container-high | background-color: rgba(var(--cds-sys-color-surface-container-high), var(--cds-sys-bg-opacity)); color: rgba(var(--cds-sys-color-on-surface), var(--cds-sys-text-opacity)); |
| surface-container | background-color: rgba(var(--cds-sys-color-surface-container), var(--cds-sys-bg-opacity)); color: rgba(var(--cds-sys-color-on-surface), var(--cds-sys-text-opacity)); |
| surface-container-low | background-color: rgba(var(--cds-sys-color-surface-container-low), var(--cds-sys-bg-opacity)); color: rgba(var(--cds-sys-color-on-surface), var(--cds-sys-text-opacity)); |
| surface-container-lowest | background-color: rgba(var(--cds-sys-color-surface-container-lowest), var(--cds-sys-bg-opacity)); color: rgba(var(--cds-sys-color-on-surface), var(--cds-sys-text-opacity)); |
| bg-background | background-color: rgba(var(--cds-sys-color-bacground), var(--cds-sys-bg-opacity)); |
| bg-surface | background-color: rgba(var(--cds-sys-color-surface), var(--cds-sys-bg-opacity)); |
| bg-surface-container-highest | background-color: rgba(var(--cds-sys-color-surface-container-highest), var(--cds-sys-bg-opacity)); |
| bg-surface-container-high | background-color: rgba(var(--cds-sys-color-surface-container-high), var(--cds-sys-bg-opacity)); |
| bg-surface-container-low | background-color: rgba(var(--cds-sys-color-surface-container-low), var(--cds-sys-bg-opacity)); |
| bg-surface-container-lowest | background-color: rgba(var(--cds-sys-color-surface-container-lowest), var(--cds-sys-bg-opacity)); |
There are five surface roles:
- Background - Default color for application backgrounds
- On background - Text and icons against the background color
- Surface - Default color for backgrounds of sections, cards, areas, ...
- On surface - Text and icons against any surface color
- On surface variant - Lower-emphasis color for text and icons against any surface color
There are also five surface container roles named based on their level of emphasis:
- Surface container lowest โ Lowest-emphasis container color
- Surface container low โ Low-emphasis container color
- Surface container โ Default container color
- Surface container high โ High-emphasis container color
- Surface container highest โ Highest-emphasis container color
WARNING
Using the .surface class or any surface-container variant simultaneously sets both the background color and the on-surface text color.
This is the recommended approach for coloring layers in the Campus Design System.
If an exception is necessary, the use of .bg-surface is possible but should be approached with caution, as it is considered highly exceptional.
<div class="[...] surface">Surface</div>
-
<div class="[...] surface-container-high">Surface Container High</div>
<div class="[...] surface-container-lowest on-surface-variant">Surface Container Lowest</div>2. Primary โ
Roles used for prominent elements and actions on the screen.
Primary Roles:
| Class Name | CSS Equivalent |
|---|---|
| primary | background-color: rgba(var(--cds-sys-color-primary), var(--cds-sys-bg-opacity)); color: rgba(var(--cds-sys-color-on-primary), var(--cds-sys-text-opacity)); |
| primary-container | background-color: rgba(var(--cds-sys-color-primary-container), var(--cds-sys-bg-opacity)); color: rgba(var(--cds-sys-color-on-primary), var(--cds-sys-text-opacity)); |
| bg-primary | background-color: rgba(var(--cds-sys-color-primary), var(--cds-sys-bg-opacity)); |
| bg-primary-container | background-color: rgba(var(--cds-sys-color-primary), var(--cds-sys-bg-opacity)); |
There are four primary roles:
- Primary - Default color for prominent elements and actions
- On primary - Text and icons against the primary color
- Primary container - Default color for backgrounds of sections, cards, areas, ...
- On primary container - Text and icons against any primary container color
WARNING
Using the .primary class or any primary-container variant simultaneously sets both the background color and the on-primary text color.
This is the recommended approach for coloring elements in the Campus Design System.
If an exception is necessary, the use of .bg-primary is possible but should be approached with caution, as it is considered highly exceptional.
<div class="[...] primary">Primary</div>
<div class="[...] on-primary">On Primary</div>
<div class="[...] primary-container">Primary Container</div>
<div class="[...] text-primary">Text Primary</div>Primary Addon Roles
INFO
Fixed Accent Colors
Fixed accent colors, including primary fixed, provide fill colors used against the surface. These colors maintain the same tone in light and dark themes, unlike regular container colors, which change in tone between these themes. The fixed color role may be used instead of the equivalent container role in situations where such fixed behavior is desired.
Fixed Dim Accent Colors
Fixed dim accent colors, such as primary fixed dim, provide a stronger, more emphasized tone relative to the equivalent fixed color. They may be used where a deeper color but the same fixed behavior is desired.
| Class Name | CSS Equivalent |
|---|---|
| primary-fixed | background-color: rgba(var(--cds-sys-color-primary-fixed), var(--cds-sys-bg-opacity)); color: rgba(var(--cds-sys-color-on-primary), var(--cds-sys-text-opacity)); |
| primary-fixed-dim | background-color: rgba(var(--cds-sys-color-primary-fixed-dim), var(--cds-sys-bg-opacity)); color: rgba(var(--cds-sys-color-on-primary), var(--cds-sys-text-opacity)); |
| bg-primary-fixed | background-color: rgba(var(--cds-sys-color-primary-fixed), var(--cds-sys-bg-opacity)); |
| bg-primary-fixed-variant | background-color: rgba(var(--cds-sys-color-primary-fixed-variant), var(--cds-sys-bg-opacity)); |
- primary-fixed - Default color for primary elements against the surface, maintaining the same in tone in light and dark themes.
- on-primary-fixed - Text and icons against the primary fixed color.
- primary-fixed-dim - Stronger, more emphasized tone for the primary fixed color.
- on-primary-fixed-variant - Lower-emphasis color for text and icons against the primary fixed color.
<div class="[...] primary-fixed">Primary Fixed</div>
<div class="[...] on-primary-fixed">On Primary Fixed</div>3. Secondary โ
Roles used for elements and actions that are distinct from primary elements on the screen.
Secondary Roles:
| Class Name | CSS Equivalent |
|---|---|
| secondary | background-color: rgba(var(--cds-sys-color-secondary), var(--cds-sys-bg-opacity)); color: rgba(var(--cds-sys-color-on-secondary), var(--cds-sys-text-opacity)); |
| secondary-container | background-color: rgba(var(--cds-sys-color-secondary-container), var(--cds-sys-bg-opacity)); color: rgba(var(--cds-sys-color-on-secondary), var(--cds-sys-text-opacity)); |
| bg-secondary | background-color: rgba(var(--cds-sys-color-secondary), var(--cds-sys-bg-opacity)); |
| bg-secondary-container | background-color: rgba(var(--cds-sys-color-secondary), var(--cds-sys-bg-opacity)); |
There are four secondary roles:
- Secondary - Default color for elements and actions distinct from primary elements
- On secondary - Text and icons against the secondary color
- Secondary container - Default color for backgrounds of sections, cards, areas, ...
- On secondary container - Text and icons against any secondary container color
WARNING
Using the .secondary class or any secondary-container variant simultaneously sets both the background color and the on-secondary text color.
This is the recommended approach for coloring elements in the Campus Design System.
If an exception is necessary, the use of .bg-secondary is possible but should be approached with caution, as it is considered highly exceptional.
<div class="[...] secondary">Secondary</div>
<div class="[...] on-secondary">On Secondary</div>
<div class="[...] secondary-container">Secondary Container</div>
<div class="[...] bg-secondary">Bg Secondary</div>Secondary Addon Roles
INFO
Fixed Accent Colors
Fixed accent colors, including secondary fixed, provide fill colors used against the surface. These colors maintain the same tone in light and dark themes, unlike regular container colors, which change in tone between these themes. The fixed color role may be used instead of the equivalent container role in situations where such fixed behavior is desired.
Fixed Dim Accent Colors
Fixed dim accent colors, such as secondary fixed dim, provide a stronger, more emphasized tone relative to the equivalent fixed color. They may be used where a deeper color but the same fixed behavior is desired.
| Class Name | CSS Equivalent |
|---|---|
| secondary-fixed | background-color: rgba(var(--cds-sys-color-secondary-fixed), var(--cds-sys-bg-opacity)); color: rgba(var(--cds-sys-color-on-secondary), var(--cds-sys-text-opacity)); |
| secondary-fixed-dim | background-color: rgba(var(--cds-sys-color-secondary-fixed-dim), var(--cds-sys-bg-opacity)); color: rgba(var(--cds-sys-color-on-secondary), var(--cds-sys-text-opacity)); |
| bg-secondary-fixed | background-color: rgba(var(--cds-sys-color-secondary-fixed), var(--cds-sys-bg-opacity)); |
| bg-secondary-fixed-variant | background-color: rgba(var(--cds-sys-color-secondary-fixed-variant), var(--cds-sys-bg-opacity)); |
- secondary-fixed - Default color for secondary elements against the surface, maintaining the same tone in light and dark themes.
- on-secondary-fixed - Text and icons against the secondary fixed color.
- secondary-fixed-dim - Stronger, more emphasized tone for the secondary fixed color.
- on-secondary-fixed-variant - Lower-emphasis color for text and icons against the secondary fixed color.
<div class="[...] secondary-fixed">Secondary Fixed</div>
<div class="[...] on-secondary-fixed">On Secondary Fixed</div>4. Error โ
Roles used to indicate errors and critical information.
Error Roles:
| Class Name | CSS Equivalent |
|---|---|
| error | background-color: rgba(var(--cds-sys-color-error), var(--cds-sys-bg-opacity)); color: rgba(var(--cds-sys-color-on-error), var(--cds-sys-text-opacity)); |
| error-container | background-color: rgba(var(--cds-sys-color-error-container), var(--cds-sys-bg-opacity)); color: rgba(var(--cds-sys-color-on-error), var(--cds-sys-text-opacity)); |
| on-error | color: rgba(var(--cds-sys-color-on-error), var(--cds-sys-text-opacity)); |
| bg-error | background-color: rgba(var(--cds-sys-color-error), var(--cds-sys-bg-opacity)); |
| bg-error-container | background-color: rgba(var(--cds-sys-color-error-container), var(--cds-sys-bg-opacity)); |
There are four error roles:
- Error - Default color for error elements and critical information
- On error - Text and icons against the error color
- Error container - Default color for backgrounds of sections, cards, areas, ...
- Text error - Default color for error text
WARNING
Using the .error class or any error-container variant simultaneously sets both the background color and the on-error text color.
This is the recommended approach for indicating errors and critical information in the Campus Design System.
If an exception is necessary, the use of .bg-error is possible but should be approached with caution, as it is considered highly exceptional.
<div class="[...] error">Error</div>
<div class="[...] on-error">On Error</div>
<div class="[...] error-container">Error Container</div>
<div class="[...] bg-error">Bg Error</div>5. Success โ
Roles used to indicate successful or positive elements.
Success Roles:
| Class Name | CSS Equivalent |
|---|---|
| success | background-color: rgba(var(--cds-sys-color-success), var(--cds-sys-bg-opacity)); color: rgba(var(--cds-sys-color-on-success), var(--cds-sys-text-opacity)); |
| success-container | background-color: rgba(var(--cds-sys-color-success-container), var(--cds-sys-bg-opacity)); color: rgba(var(--cds-sys-color-on-success), var(--cds-sys-text-opacity)); |
| on-success | color: rgba(var(--cds-sys-color-on-success), var(--cds-sys-text-opacity)); |
| bg-success | background-color: rgba(var(--cds-sys-color-success), var(--cds-sys-bg-opacity)); |
| bg-success-container | background-color: rgba(var(--cds-sys-color-success-container), var(--cds-sys-bg-opacity)); |
There are four success roles:
- Success - Default color for successful or positive elements
- On success - Text and icons against the success color
- Success container - Default color for backgrounds of sections, cards, areas, ...
- On success container - Text and icons against any success container color
WARNING
Using the .success class or any success-container variant simultaneously sets both the background color and the on-success text color.
This is the recommended approach for indicating success or positive elements in the Campus Design System.
If an exception is necessary, the use of .bg-success is possible but should be approached with caution, as it is considered highly exceptional.
<div class="[...] success">Success</div>
<div class="[...] on-success">On Success</div>
<div class="[...] success-container">Success Container</div>
<div class="[...] bg-success">Bg Success</div>6. Warn โ
Roles used to indicate warnings or cautionary elements.
Warning Roles:
| Class Name | CSS Equivalent |
|---|---|
| warn | background-color: rgba(var(--cds-sys-color-warn), var(--cds-sys-bg-opacity)); color: rgba(var(--cds-sys-color-on-warn), var(--cds-sys-text-opacity)); |
| warn-container | background-color: rgba(var(--cds-sys-color-warn-container), var(--cds-sys-bg-opacity)); color: rgba(var(--cds-sys-color-on-warn), var(--cds-sys-text-opacity)); |
| on-warn | color: rgba(var(--cds-sys-color-on-warn), var(--cds-sys-text-opacity)); |
| bg-warn | background-color: rgba(var(--cds-sys-color-warn), var(--cds-sys-bg-opacity)); |
| bg-container-warn | background-color: rgba(var(--cds-sys-color-container-warn), var(--cds-sys-bg-opacity)); |
There are four warn roles:
- Warning - Default color for warn or cautionary elements
- On warn - Text and icons against the warn color
- Warning container - Default color for backgrounds of sections, cards, areas, ...
- On warn container - Text and icons against any warn container color
WARNING
Using the .warn class or any warn-container variant simultaneously sets both the background color and the on-warn text color.
This is the recommended approach for indicating warns or cautionary elements in the Campus Design System.
If an exception is necessary, the use of .bg-warn is possible but should be approached with caution, as it is considered highly exceptional.
<div class="[...] warn">Warning</div>
<div class="[...] on-warn">On Warning</div>
<div class="[...] warn-container">Warning Container</div>
<div class="[...] bg-warn">Bg Warning</div>7. Excellent โ
Roles used to indicate excellent or positive elements.
Excellent Roles:
| Class Name | CSS Equivalent |
|---|---|
| excellent | background-color: rgba(var(--cds-sys-color-excellent), var(--cds-sys-bg-opacity)); color: rgba(var(--cds-sys-color-on-excellent), var(--cds-sys-text-opacity)); |
| excellent-container | background-color: rgba(var(--cds-sys-color-excellent-container), var(--cds-sys-bg-opacity)); color: rgba(var(--cds-sys-color-on-excellent), var(--cds-sys-text-opacity)); |
| on-excellent | color: rgba(var(--cds-sys-color-on-excellent), var(--cds-sys-text-opacity)); |
| bg-excellent | background-color: rgba(var(--cds-sys-color-excellent), var(--cds-sys-bg-opacity)); |
| bg-container-excellent | background-color: rgba(var(--cds-sys-color-container-excellent), var(--cds-sys-bg-opacity)); |
There are four excellent roles:
- Excellent - Default color for excellent or positive elements
- On excellent - Text and icons against the excellent color
- Excellent container - Default color for backgrounds of sections, cards, areas, ...
- On excellent container - Text and icons against any excellent container color
WARNING
Using the .excellent class or any excellent-container variant simultaneously sets both the background color and the on-excellent text color.
This is the recommended approach for indicating excellent or positive elements in the Campus Design System.
If an exception is necessary, the use of .bg-excellent is possible but should be approached with caution, as it is considered highly exceptional.
<div class="[...] excellent">Excellent</div>
<div class="[...] on-excellent">On Excellent</div>
<div class="[...] excellent-container">Excellent Container</div>
<div class="[...] bg-excellent">Bg Excellent</div>Changing the opacity โ
Control the opacity of an elementโs background color using the bg-opacity-{name} classes.
For the full list of classes to apply background-opacity, see: Styles/Utilities/Effects/Opacity.