Elevation in Material Design is measured as the distance between Material surfaces. The distance from the front of one Material surface to the front of another is measured along the z-axis in density-independent pixels (dps) and depicted (by default) using shadows (source).
In Kustom set the elevation global to an appropriate lower value and change the dark theme overlay.
All elements have default values for resting elevation and dynamic elevation offsets. Certain components are positioned at higher elevations than others, establishing a consistent elevation order across all components. For example, dialogs always appear in front of all other components.
The following table lists default values for resting elevation and dynamic elevation offsets.
Shadows in Android
Android uses a lighting engine to draw shadows; it contains a light source that creates ambient and spot shadows. The light is aligned to the top edge of the display and is located 600dp away from it.
Shadows on Android change Y and X offset depending on their location in relation to the light source. Items that are closer to the top edge will have a shadow with a null Y offset value. Items that are closer to the bottom edge will have a large Y offset, with visible shadows that go far below their background. This all happens dynamically, even as you scroll, but the effect is subtle.
Google Design provides a Material Design Stickersheet with elevation shadows. However, those do not match the elevation shadows on Android, as they are based off of the web components.
Shadows on Android are much softer.
Below are listed values and settings for both options. When building a Material komponent you can choose whichever one you like and want to use most.
The shadow of a Material is combined from multiple shadows. Below are the formulas for blur, distance and color of each shadow.
To easily control the color of the shadow, make a global text called "Shadow".
You can set that global to the Color Name (like Primary and Secondary) or a hex value of choice (default = #000000).
For the actual color formula that the shadows will use, make a global text called "Shade":
And lastly, make a global list called "elevation" with options:
DEFAULT CSS SHADOWS (web)
ANDROID ADAPTED SHADOWS
ColorTechnically it's 3.9, but Kustom rounds down all values.
Kustom Outline @0dp
When a Card has an elevation of 0dp (desktop - resting), the shadows are replaced with an outline.
The outline's color is the On Surface color with the quaternary opacity level:
Dark Theme Elevation Overlay
When dark mode is turned on, elevation overlays are shown above views that have any elevation applied. This overlay is white by default, but can also be customized.
The overlay changes opacity depending on the elevation:
0dp = 0%
1dp = 5%
2dp = 7%
3dp = 8%
4dp = 9%
6dp = 11%
8dp = 12%
12dp = 14%
16dp = 15%
24dp = 16%
Kustom can also handle overlays automatically. But instead of using another translucent shape on top of the surface, the overlay can simply be mixed into the surface color.
To easily transfer the elevation overlay color from the root to every komponent, make a global color called "Overlay".
You can set that global to any color, provided that its alpha is always set to 100% (default = #FFFFFFFF).
Whilst the black color of the shadow only darkens the surface below, the default white overlay can make the current surface color diluted, losing its vibrancy. This issue can be resolved by picking a custom overlay color.
Mix the Surface color with the Overlay color by the appropriate amount based on the elevation global:The formula can change based on what component it's applied to.
You can also ignore the elevation overlays, if you’d like to use your own ‘elevated’ surface colors instead (unlink colors).
The Material can also express elevation through its opacity.
Make a global list (or number - list suggested) called Opacity:Add or change the options based on your setup.
To override the preset list options, turn the global into a formula and write in a custom value (0-100).
Add opacity to the Surface color mix:
Using Opacity in Surface Gradients (BETA)
Here you have 3 ways of implementation:
ignore the opacity global;
use 2 options from the opacity global or
put 2 values into one option of the opacity global.
2 options from the list
2 values from 1 list option