You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: libs/design/guides/foundations/color.md
+7-2
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,15 @@
1
1
# Color
2
-
Color helps to distinguish and create consistent experiences across products.
2
+
Color helps to distinguish and create consistent experiences across products. It highlights key areas, conveys status, urgency, and guides attention.
3
+
4
+
## Color palettes
5
+
The design system includes three core palettes that reflect Daffodil's brand identity, three palettes used to indicate status, and a neutral palette that is dominant throughout the design system. These palettes are built using [HSLuv](https://www.hsluv.org/), a color space designed as a human-friendly alternative to the standard HSL. It aims to address the limitations of traidtional color spaces like RGB and HSL.
6
+
7
+
For guidance on how to set up your theme with customized palettes, see the [Theming](/libs/design/guides/foundations/theming.md) guide.
3
8
4
9
## Accessibility
5
10
We are committed to complying with the [Web Content Accessibility Guidelines (WCAG) 2.1](https://www.w3.org/TR/WCAG/). The design system is built to meet these guidelines automatically. If you choose to identify your own color palettes outside of Daffodil's colors, please make sure to choose primary, secondary, tertiary, and extended colors that will pass the guidelines. Ensure there is sufficient color contrast between elements so that people who are visually impaired can see and use your products.
6
11
7
-
## Color Contrast
12
+
###Color Contrast
8
13
We have encoded many of the WCAG requirements into our SASS mixins and functions. This means that if you swap to a color palette that does not meet the requirements of WCAG compliance and try to use it within the components, our code will proactively complain and issue errors. This is entirely intentional and will not be changed. The current state of accessibility is lacking, and as a result, we are enforcing accessibility requirements at development time in order to make it easier for developers to accommodate these issues before they are in the hands of users.
9
14
10
15
To verify contrast ratios, we recommend using this [contrast ratio calculator](https://contrast-ratio.com/).
Copy file name to clipboardExpand all lines: libs/design/guides/foundations/theming.md
+69-49
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,46 @@
1
1
# Theming
2
-
Daffodil's theming capabilities enables you to customize `@daffodil/design` components to reflect your brand. A theme consists of custom color configurations that will work in dark and light themes.
2
+
Daffodil's theming capabilities enable you to customize `@daffodil/design`'s component color styles to reflect your brand or product.
3
3
4
-
## Custom Colors
5
-
:stop: Before you begin, read the [accessibility guide on color in `@daffodil/design`](./color.md#accessibility).
4
+
## Overview
5
+
Themes allow you to customize `@daffodil/design` components to match your brand or product's visual style using a set of universal variables, eliminating the need for individual component modifications.
6
6
7
-
## Themes
8
-
Dark and light modes are supported in all `@daffodil/design` components. When a theme is not specified, Daffodil defaults to the `light` mode.
7
+
## Before you begin
8
+
`@daffodil/design` is built with [Sass](https://sass-lang.com/). You should be familiar with the basics of CSS and Sass, including variables, functions, and mixins.
9
+
10
+
## Modes
11
+
Dark and light modes are supported in all `@daffodil/design` components. When a mode is not specified, Daffodil defaults to the `light` mode.
9
12
10
13
## Palettes
11
14
A palette is a collection of [perceptually uniform colors](https://programmingdesignsystems.com/color/perceptually-uniform-color-spaces/) with consistent contrast ratios. `@daffodil/design`'s color palettes are represented by a Sass map, with each value in a palette called a **hue**.
12
15
13
-
## Predefined palettes
14
-
`@daffodil/design` offers predefined palettes based on our brand guidelines. You can choose to use our palettes or define your own. No further configuration is needed in your `app-theme.scss` file if you choose to use `@daffodil/design`'s palettes. Below is an example of the structure of a predefined `@daffodil/design` palette.
16
+
`@daffodil/design` includes three core palettes that reflect our brand identity, three palettes used to indicate status, and a neutral palette that is dominant throughout the design system. You can choose to use our palettes or define your own.
17
+
18
+
## Defining a theme
19
+
20
+
### Using Daffodil's default theme
21
+
22
+
```scss
23
+
@use'@daffodil/design/scss/theme'asdaff-theme;
24
+
```
25
+
26
+
Create classes in the `styles.scss` file to include the `daff-theme` mixin for `$theme` and `$theme-dark` variables. This will allow you to set a click event on a button to switch between modes. View this setup in [Stackblitz](https://stackblitz.com/edit/ng13-daffodil-design).
Create a palettes file that includes Sass maps that can be used as `$primary`, `$secondary`, and `$teritary` colors. Your Sass maps must have hues from 10 to 100, with a step increment of 10 like the example below:
15
44
16
45
```scss
17
46
$daff-blue: (
@@ -28,67 +57,58 @@ $daff-blue: (
28
57
);
29
58
```
30
59
31
-
###Defining your own palettes
32
-
You can define your own palettes by creating a Sass map that matches the example from above. Your Sass maps must have hues from 10 to 100, with a step increment of 10.
60
+
#### Configure your custom palettes
61
+
Configure your app to support the custom palettes and set defaults for each palette by using the `daff-configure-palettes` function:
33
62
34
-
### Setting up your custom theme file
35
-
Configure your application to support the custom palettes you created by adding the following to your `app-theme.scss` file:
| $primary | Specifies the configured palette to use for your app's primary color. |
85
+
| $secondary | Specifies the configured palette to use for your app's secondary color. |
86
+
| $tertiary | Specifies the configured palette to use for your app's tertiary color. |
87
+
| $type | Specifies the type of theme. This can be `light` or `dark`. |
66
88
67
-
Create classes in the `styles.scss` file to include the `theme` module for `$theme` and `$theme-dark` variables. This will allow you to set a click event on a button to switch between modes. [View this setup in Stackblitz](https://stackblitz.com/edit/ng13-daffodil-design)
89
+
`app-theme.scss`
68
90
69
91
```scss
70
92
@use'@daffodil/design/scss/theme'asdaff-theme;
93
+
@use'app-color-palettes'aspalette; // path to palettes file
> These lines include theme variables and functions that will generate the theme CSS and style the components.
108
+
#### Setting up the styles file with your custom theme
109
+
Create classes in the `styles.scss` file to include the `daff-theme` mixin for `$theme` and `$theme-dark` variables. This will allow you to set a click event on a button to switch between modes. [View this setup in Stackblitz](https://stackblitz.com/edit/ng13-daffodil-design-custom-theme).
90
110
91
-
Create classes in the `styles.scss` file to include the `theme` module for `$theme` and `$theme-dark` variables. This will allow you to set a click event on a button to switch between modes. [View this setup in Stackblitz](https://stackblitz.com/edit/ng13-daffodil-design-custom-theme)
0 commit comments