toFluentShades
Turns a tonal ramp into the seven shades Fluent themes from.
Fluent ships one accent, Windows blue, and generateShades is a lookup with a single entry, so any other accent silently comes back as that blue. This is the way round it. Give Fluent a ramp that was generated rather than looked up.
The tones below are anchored to the lightness of Microsoft's own Windows blue family, rounded to the nearest five.
| Shade | Windows blue | its tone | tone used here |
|---|---|---|---|
| Shades.dark3 | #001968 | 13.8 | 15 |
| Shades.dark2 | #003D92 | 27.9 | 30 |
| Shades.dark1 | #005EB7 | 40.3 | 40 |
| Shades.base | #0078D4 | 49.7 | 50 |
| Shades.light1 | #0093F9 | 59.6 | 60 |
| Shades.light2 | #60CCFE | 77.8 | 80 |
| Shades.light3 | #98ECFE | 88.8 | 90 |
Microsoft's ramp shifts hue as it goes, 64 degrees from the darkest shade to the lightest, and a tonal palette holds hue steady. So this matches the lightness of that ramp and not its hue. The result is a ramp of one color rather than a reproduction of the Windows one, which is what you want from a generated accent anyway.
A seed with little chroma gives a Fluent theme with little chroma. A grey seed produces seven greys, which is the ramp doing its job rather than a fault.
// Fluent themed off the scheme's secondary ramp rather than its primary.
val shades = scheme.secondaryPalette.toFluentShades()
FluentTheme(colors = Colors(shades, darkMode = scheme.isDark)) {
Text("Themed from the secondary ramp")
}Receiver
The ramp to read the seven tones from, usually a scheme's primary palette.
Return
Shades for Colors, or for anything else taking Fluent's shades.