Overview
Applies tint according to Material Design Guidelines to generate surface elevation variants (surface1-surface5). This method creates tinted versions of colors by mixing them with thesurfaceTint color at predefined elevation levels.
Signature
Parameters
The colors object containing Material Design color tokens. Must include a
surfaceTint property.Optional array of color keys to generate tint versions for. If not provided or
false, tint variants will be generated for all keys except surfaceTint.Example: ['surface', 'background']Returns
The input colors object with added elevation variants (1-5) for each tinted color.For each color key, five new properties are added:
{key}1- Elevation level 1 (5% tint){key}2- Elevation level 2 (8% tint){key}3- Elevation level 3 (11% tint){key}4- Elevation level 4 (12% tint){key}5- Elevation level 5 (14% tint)
Example
CSS Variables Output
Selective Tinting
You can tint only specific colors by providing theonlyKeys parameter:
Implementation Details
The method uses the following elevation-to-tint mapping from Material Design:| Elevation | Tint Amount |
|---|---|
| 1 | 5% |
| 2 | 8% |
| 3 | 11% |
| 4 | 12% |
| 5 | 14% |
www/plugin.js:69-89
Related Methods
tintSurfaceColors- Convenience wrapper for surface colors onlymixColorElevation- Mix two colors using elevation levelscolorsToDom- Apply tinted colors to the DOM