Skip to content

Commit 1e13013

Browse files
committed
Update Dark theme documentation
PiperOrigin-RevId: 245964758
1 parent 566a4bc commit 1e13013

File tree

1 file changed

+32
-22
lines changed

1 file changed

+32
-22
lines changed

docs/theming/Dark.md

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<!--docs:
2-
title: "Dark Theming"
2+
title: "Dark Theme"
33
layout: detail
44
section: theming
5-
excerpt: "Dark Theming"
5+
excerpt: "Dark Theme"
66
iconId: dark
77
path: /theming/dark/
88
-->
99

10-
# Dark Theming
10+
# Dark Theme
1111

12-
The Material Design Dark Theming system can be used to create a beautiful and
13-
functional Dark Theme for your app, which consists of dark background colors and
12+
The Material dark theme system can be used to create a beautiful and functional
13+
dark theme for your app, which generally consists of dark background colors and
1414
light foreground colors for elements such as text an iconography.
1515

16-
Some of the most common benefits of a Dark Theme include conserving battery
16+
Some of the most common benefits of a dark theme include conserving battery
1717
power for devices with OLED screens, reducing eye strain, and facilitating use
1818
in low-light environments.
1919

@@ -40,30 +40,40 @@ your app theme to inherit from either `Theme.MaterialComponents` or
4040
</style>
4141
```
4242

43-
The `Theme.MaterialComponents` theme is a static Dark Theme, whereas the
43+
The `Theme.MaterialComponents` theme is a static dark theme, whereas the
4444
`Theme.MaterialComponents.DayNight` theme will help facilitate easy switching
45-
between your app's Light and Dark Theme.
45+
between your app's `Light` and `Dark` theme.
46+
47+
### Catalog
48+
49+
To see how Material components adapt in a dark theme, build and run the
50+
[Catalog app](../catalog-app.md) on an Android 9 device. Then enable Night mode
51+
via `Settings > System > Developer options > Night mode`.
4652

4753
### Color Palette
4854

49-
The core of any Dark Theme is a color palette that uses dark background colors
50-
and light foreground colors. The Material Dark Themes make use of the
51-
[Material Color System](Color.md), in order to provide default Dark Theme values
55+
At the core of any dark theme is a color palette that uses dark background
56+
colors and light foreground colors. The Material `Dark` themes make use of the
57+
[Material Color System](Color.md), in order to provide default dark theme values
5258
for neutral palette colors such as `colorBackground` and `colorSurface`.
5359

54-
The Material Dark Themes also provide adjusted defaults for the baseline branded
55-
palette, including `colorPrimary` and `colorSecondary`. Guidance for how you can
56-
adjust your brand colors for Dark Theme will be provided soon.
60+
The Material `Dark` theme baseline background and surface colors are dark gray
61+
instead of black, which increases visibility for shadows and also reduces eye
62+
strain for light text.
63+
64+
The Material `Dark` themes also provide adjusted defaults for the baseline
65+
branded palette, including `colorPrimary` and `colorSecondary`. Guidance for how
66+
you can adjust your brand colors for dark theme will be provided soon.
5767

5868
### Elevation Overlays
5969

6070
In addition to the color palette adjustments mentioned above, communicating the
61-
hierarchy of a UI via elevation requires some Dark Theme specific
71+
hierarchy of a UI via elevation requires some dark theme specific
6272
considerations.
6373

64-
Shadows are less effective in an app using a Dark Theme, because they will have
74+
Shadows are less effective in an app using a dark theme, because they will have
6575
less contrast with the dark background colors and will appear to be less
66-
visible. In order to compensate for this, Material surfaces in a Dark Theme
76+
visible. In order to compensate for this, Material surfaces in a dark theme
6777
become lighter at higher elevations, when they are closer to the implied light
6878
source.
6979

@@ -80,7 +90,7 @@ surface's background, instead of drawing another layer to the canvas.
8090
#### Affected Components
8191

8292
The following is a list of Material components that support elevation overlays
83-
in Dark Theme, because they use `colorSurface` and can be elevated:
93+
in dark theme, because they use `colorSurface` and can be elevated:
8494

8595
* Top App Bar
8696
* Bottom App Bar
@@ -100,7 +110,7 @@ the following theme attributes:
100110

101111
Attribute Name |Description |Default Value
102112
-----------------------------|-------------------------------------------------------------------------------------|-------------
103-
`elevationOverlaysEnabled` |Whether the elevation overlay functionality is enabled. |`false` in Light Themes, `true` in Dark Themes
113+
`elevationOverlaysEnabled` |Whether the elevation overlay functionality is enabled. |`false` in `Light` themes, `true` in `Dark` themes
104114
`elevationOverlaysColor` |The color used for the elevation overlays, applied at an alpha based on elevation. |`colorOnSurface`
105115

106116
Note: If inheriting from the `Theme.MaterialComponents` theme or a descendant,
@@ -109,7 +119,7 @@ Material themes already set up the above defaults.
109119

110120
#### Custom Views & Non-Material Components
111121

112-
If you would like to apply Dark Theme elevation overlays to your custom views or
122+
If you would like to apply dark theme elevation overlays to your custom views or
113123
any non-Material views that are elevated surfaces, then you can use the
114124
`MaterialShapeDrawable` or `ElevationOverlayProvider` APIs.
115125

@@ -131,14 +141,14 @@ compounding the overlays multiple times.
131141
##### ElevationOverlayProvider
132142

133143
If you have a case where the elevation value is more static and you would like
134-
to get the corresponding Dark Theme overlay color (perhaps to color an existing
144+
to get the corresponding dark theme overlay color (perhaps to color an existing
135145
view), then you can use `ElevationOverlayProvider`.
136146

137147
If elevation overlays are enabled at the theme level, the
138148
`ElevationOverlayProvider#getSurfaceColorWithOverlayIfNeeded` method will return
139149
`colorSurface` with the overlay color blended in at an alpha level based on the
140150
elevation passed in. Otherwise, it will simply return `colorSurface`, so that
141-
you can use the result of this method in both Light and Dark Themes without
151+
you can use the result of this method in both `Light` and `Dark` themes without
142152
needing any additional orchestration.
143153

144154
If you need to blend the overlays with an arbitrary color or an adjusted surface

0 commit comments

Comments
 (0)