@@ -28,15 +28,15 @@ Android system UI and apps running on the device.
2828- [ Android Q Dark Theme Documentation] [ dark-theme-dac-docs ]
2929- [ AppCompat DayNight Documentation] [ daynight-appcompat-docs ]
3030
31- ### Setup
31+ ## Setup
3232
3333In order to support the dark theme functionality in Android Q, make sure you are
3434depending on the ` 1.1.0 ` stable version of the
3535[ Material Android library] [ maven-repo-mdc ] or later, and update your app theme
3636to inherit from ` Theme.MaterialComponents.DayNight ` (or one of its descendants).
3737E.g.:
3838
39- ##### res/values/themes.xml
39+ ** res/values/themes.xml**
4040
4141``` xml
4242<style name =" Theme.MyApp" parent =" Theme.MaterialComponents.DayNight" >
@@ -48,15 +48,15 @@ Alternatively, if you want to define separate `Light` and `Dark` themes for your
4848app, you can inherit from ` Theme.MaterialComponents.Light ` in the ` values `
4949directory, and ` Theme.MaterialComponents ` in the ` values-night ` directory. E.g.:
5050
51- ##### res/values/themes.xml
51+ ** res/values/themes.xml**
5252
5353``` xml
5454<style name =" Theme.MyApp" parent =" Theme.MaterialComponents.Light" >
5555 <!-- ... -->
5656</style >
5757```
5858
59- ##### res/values-night/themes.xml
59+ ** res/values-night/themes.xml**
6060
6161``` xml
6262<style name =" Theme.MyApp" parent =" Theme.MaterialComponents" >
@@ -70,7 +70,7 @@ facilitate easy switching between your app's `Light` and `Dark` theme. If using
7070a ` DayNight ` theme, you can define one app theme that references color
7171resources, which can be overridden in the ` values-night ` directory if needed.
7272
73- ### Catalog
73+ ## Catalog
7474
7575To see how Material components adapt in a dark theme, build and run the
7676[ Catalog app] ( ../catalog-app.md ) and enable dark theme in one of the following
8080* Android Q: ` Settings > Display > Dark Theme ` (or Dark Theme tile in Notification Tray)
8181* Android P: ` Settings > System > Developer options > Night mode `
8282
83- ### Color Palette
83+ ## Color Palette
8484
8585At the core of any dark theme is a color palette that uses dark background
8686colors and light foreground colors. The Material ` Dark ` themes make use of the
@@ -96,7 +96,7 @@ branded palette, including `colorPrimary` and `colorSecondary`. See the
9696[ Material Dark Theme spec] [ dark-theme-mdc-spec-ui-application ] for guidance on
9797how you can adjust your brand colors for dark theme.
9898
99- #### Primary vs. Surface Coloring for Large Surfaces
99+ ### Primary vs. Surface Coloring for Large Surfaces
100100
101101According to the
102102[ Material Dark Theme spec] [ dark-theme-mdc-spec-custom-application ] , large
@@ -125,7 +125,7 @@ dark theme. E.g.:
125125* ` Widget.MaterialComponents.TabLayout.PrimarySurface `
126126* ` Widget.MaterialComponents.Toolbar.PrimarySurface `
127127
128- ### Elevation Overlays
128+ ## Elevation Overlays
129129
130130In addition to the color palette adjustments mentioned above, communicating the
131131hierarchy of a UI via elevation requires some dark theme specific
@@ -147,7 +147,7 @@ Note: we avoid overdraw with the elevation overlays by calculating a composite
147147blend of the surface color with the overlay color and using that as the
148148surface's background, instead of drawing another layer to the canvas.
149149
150- #### Affected Components
150+ ### Affected Components
151151
152152The following is a list of Material components that support elevation overlays
153153in dark theme, because they use ` colorSurface ` and can be elevated:
@@ -163,7 +163,7 @@ in dark theme, because they use `colorSurface` and can be elevated:
163163* [ Navigation Drawer] ( ../components/NavigationDrawer.md )
164164* [ Switch] ( ../components/Switch.md )
165165
166- #### Theme Attributes
166+ ### Theme Attributes
167167
168168In order to facilitate some orchestration around the elevation overlays, we have
169169the following theme attributes:
@@ -177,13 +177,13 @@ Note: If inheriting from the `Theme.MaterialComponents` theme or a descendant,
177177you most likely do not have to set these attributes yourself because the
178178Material themes already set up the above defaults.
179179
180- #### Custom Views & Non-Material Components
180+ ### Custom Views & Non-Material Components
181181
182182If you would like to apply dark theme elevation overlays to your custom views or
183183any non-Material views that are elevated surfaces, then you can use the
184184` MaterialShapeDrawable ` or ` ElevationOverlayProvider ` APIs.
185185
186- ##### MaterialShapeDrawable
186+ #### MaterialShapeDrawable
187187
188188The key to supporting elevation overlays in a custom view is creating a
189189` MaterialShapeDrawable ` with the overlay support enabled via
@@ -198,7 +198,7 @@ will keep track of the elevation value for you and factor that in to the overlay
198198any time elevation changes, and you don't have to worry about incorrectly
199199compounding the overlays multiple times.
200200
201- ##### ElevationOverlayProvider
201+ #### ElevationOverlayProvider
202202
203203If you have a case where the elevation value is more static and you would like
204204to get the corresponding dark theme overlay color (perhaps to color an existing
@@ -216,7 +216,7 @@ color, or get access to lower level values such as the overlay alpha
216216percentages, take a look at the other ` ElevationOverlayProvider ` methods
217217including ` compositeOverlayIfNeeded ` , ` compositeOverlay ` , and ` calculateOverlayAlpha ` .
218218
219- ##### Absolute Elevation
219+ #### Absolute Elevation
220220
221221When calculating the elevation overlay alpha percentage, Material components
222222factor in the absolute elevation of their parent view. This is because the
0 commit comments