Overview
tintSurfaceColors is a convenience wrapper around tintColors that applies Material Design tinting specifically to surface and background-related colors. This method is ideal when you only need elevation variants for surfaces without generating variants for all color tokens.
Signature
Parameters
The colors object containing Material Design color tokens. Must include a
surfaceTint property.Returns
The input colors object with added elevation variants (1-5) for the following surface-related color keys:
backgroundonBackgroundsurfaceonSurfacesurfaceVariantonSurfaceVariantinverseSurfaceinverseOnSurface
{key}1, {key}2, {key}3, {key}4, {key}5Example
CSS Variables Output
Common Use Case
This method is commonly used in the plugin workflow to apply surface tinting before injecting colors into the DOM:Surface Colors Tinted
The following color tokens receive elevation variants:| Color Token | Description |
|---|---|
background | Main background color |
onBackground | Text/content color on background |
surface | Surface color for components |
onSurface | Text/content color on surface |
surfaceVariant | Variant surface color |
onSurfaceVariant | Text/content color on surface variant |
inverseSurface | Inverse surface color |
inverseOnSurface | Text/content color on inverse surface |
Implementation Details
Implementation location:www/plugin.js:91-104
The method internally calls:
Related Methods
tintColors- Tint any color keys with custom selectionmixColorElevation- Mix colors using elevation levelscolorsToDom- Apply colors to the DOM as CSS variables