Colors
Colors in aragonUI are managed by its theming system. An aragonUI theme is a set of colors assigned to a predefined palette. All aragonUI components use colors from this palette, making it possible to swap the theme for another one dynamically. aragonUI includes two themes by default, light and dark, but any other can be provided.
The theme palette can be obtained in a component by using the
useTheme()
hook:function App() {
const theme = useTheme()
return (
<Main>
<p
css={`
color: ${theme.negative};
`}
>
Negative content
</p>
</Main>
)
}
Colors meant to be applied on text are indicated using the Content suffix. The reason why it is not using Text is because these also apply to other outline content like icons.
When a color like foo is followed by a color named fooContent, it generally means that foo should be used as a background color for fooContent.
Gradients are defined using the Start and End suffixes.
Colors don’t include opacity. When using aragonUI’s
useTheme()
, the .alpha(0.5)
method can be used on any color. It will apply the desired opacity and return the result as a CSS color using the rgba()
syntax.This section describes the palette colors and how they should be used. The groups are created based on how they relate to each other.
The colors defined in this group are either used by default (border, content, overlay), or on the base layer (background).
The base layer on which apps are being rendered.
The border color used everywhere by default, except in specific cases like controlBorder.
The color used for overlays. Some components using an overlay color are SidePanel or Modal.
The base color for text and outline content. To be used over background.
Secondary color for text and outline content. To be used over background.
Used as a base color for links.
The color for focus rings.
The accent color can be used to put an emphasis on a component or a certain part of a component, without any specific semantic.
To be used for text and outline content over accent.
This is the gradient equivalent of accent.
The main surface as defined by aragonDS and its different states. This group of colors is used by components providing surfaces: Box, DataView, the default Button, the Slider handle, and many more.
The background color used for surfaces.
The primary color used for text and outline content over surface.
The secondary color used for text and outline content over surface.
This color is generally used for icons over surface. Note: in some cases, icons over surface are also using surfaceContent or surfaceContentSecondary.
This is used as a background base for surfaces that appear to be at a lower level than the parent surface itself. For instance, the DataView component is using this color for its entry expansion, which opens underneath the primary surface provided by DataView.
Communicates that a surface is being “opened”, generally revealing a surface using surfaceUnder underneath. The DataView component is using this color for the side border of its entry expansion.
Indicates that a surface, or a part of it, is being selected. This is the color DataView is using to indicate that an entire row is selected.
Indicates that a surface, or a part of it, is being highlighted. This color could be used to reflect a hover or focused state.
Indicates that a surface, or a part of it, is being pressed − either by a pointer or a touch event.
Used to indicate informative content in general.
This info color is generally stronger than infoSurface. It should be used for icons, borders, etc.
The surface info color, generally softer than info. It should be used for background colors.
To be used for text and outline content over infoSurface.
Used to signal feedback, in the broad sense. For instance, this set of colors is used to show the status of a transaction in the signing panel.
Use this color as a background color for feedback.
The primary color to be used for text and outline content over feedbackSurface.
The secondary color to be used for text and outline content over feedbackSurface.
Used to indicate warnings.
This warning color is generally stronger than warningSurface. It should be used for icons, borders, etc.
The surface warning color, generally softer than warning. It should be used for background colors.
To be used for text and outline content over warningSurface.
Used for elements related to helping the user.
This help color is generally stronger than helpSurface and should be used for icons, borders, etc.
To be used for text and outline content over help.
This help color is generally softer than help and should be used for background colors.
To be used for text and outline content over helpSurface.
Used to communicate something positive. It can be used for successful operations, but also for other things like voting “Yes”.
Use this color to communicate positive information (e.g. success, an action to vote yes).
To be used for text and outline content over positive.
A softer positive, to be used when a large amount of information needs to be communicated.
To be used for text and outline content over positiveSurface.
Used to communicate something negative. It can be used for errors, but also for other things like voting “No”.
Use this color to communicate negative information (e.g. error, an action to vote no).
To be used for text and outline content over negative.
A softer negative, to be used when a large amount of information needs to be communicated. For instance, the Info component uses it as a background color in error mode.
To be used for text and outline content over negativeSurfaceContent.
This set of colors is used by the Tag component and its different modes.
Used to identify or label a subject.
To be used for text and outline content over tagIdentifier.
Used to indicate that a subject is new, or updated.
To be used for text and outline content over tagNew.
Used for indicators in the general sense.
To be used for text and outline content over tagIndicator.
Used to represent some activity that happened, like a number of notifications.
To be used for text and outline content over tagActivity
This colors are used for badge-like components: IdentityBadge, AppBadge, etc.
The background color of badge-like components.
To be used for text and outline content over badge.
The pressed state of badge.
Floating elements, like tooltips.
The background color of a floating element.
To be used for text and outline content over floating.
Colors related to controls, that could be used in forms or elsewhere.
Used for hints (or placeholders) inside of text input or similar components.
Indicates a selection in the broad sense.
To be used for text and outline content over selected.
Indicates a selection in the broad sense, when disabled (non-interactive).
The background color of disabled components like Button.
The text or outline content to be used over disabled.
This color is generally used for icons over disabled. Note: icons over disabled could also be using disabledContent.
Used as a background color for some control components like Checkbox, Radio or Switch.
Used as a border color for some control components like Checkbox, Radio or Switch.
Used as a border color for the pressed state of some control components like Checkbox, Radio or Switch.
The background color for the disabled state of some control components like Checkbox, Radio or Switch.
This is used as a surface color for elements of control components that appear at an upper level. For instance, the Switch component is using this color for its handle.
This is used as a background base for elements of control components that appear to be at a lower level. For instance, the Switch component is using this color for its inner base.
These colors can be used when a color is needed for its semantics. An example could be a chart using a red and a blue curve. Even if their theme is different, two users should still be able to refer to these by using the terms “red” or “blue”.
Themes are free to implement their own variation of these colors, but they should respect the naming (e.g. green can vary, but should use a color that is commonly accepted to be “green”).
Available color names:
- green
- yellow
- red
- blue
- brown
- purple
Last modified 6mo ago