ColorPaletteGenerator
Pennington.MonorailCss
Generates Tailwind-style 11-step OKLCH palettes from a seed hue and chroma, plus the coordinating accent and neutral base palettes that go with them.
Methods
ApplyAlgorithmicColorScheme
#public static Theme ApplyAlgorithmicColorScheme(Theme theme, double hue, double chroma, CoordinatingScheme scheme)
Wires algorithmic palettes (base + primary + accents) onto the theme. Primary is a foreground palette at hue/chroma; base is a desaturated neutral palette at the same hue; accents are foreground palettes at hues picked by scheme. Schemes with multiple accents register the first as accent and additional ones as accent-2, accent-3, ….
Parameters
themeThemehuedoublechromadoubleschemeCoordinatingScheme
Returns
ThemeGenerateForeground
#public static ImmutableDictionary<string, string> GenerateForeground(double hue, double chroma)
Generates a vibrant foreground 11-step OKLCH palette. The 500 stop lands on chroma; other stops scale relative to it via the foreground chroma curve.
Parameters
huedoublechromadouble
Returns
ImmutableDictionary<string, string>GenerateNeutral
#public static ImmutableDictionary<string, string> GenerateNeutral(double hue, double chroma)
Generates a near-gray neutral 11-step OKLCH palette. Chroma scales by intensity (chroma / curve at 500) and the dark tail blends between tapered and held-high shapes via DarkChromaRetention.
Parameters
huedoublechromadouble
Returns
ImmutableDictionary<string, string>Pennington.MonorailCss.ColorPaletteGenerator
namespace Pennington.MonorailCss;
/// Generates Tailwind-style 11-step OKLCH palettes from a seed hue and chroma, plus the coordinating accent and neutral base palettes that go with them.
public class ColorPaletteGenerator
{
/// Wires algorithmic palettes (base + primary + accents) onto the theme. Primary is a foreground palette at hue/chroma; base is a desaturated neutral palette at the same hue; accents are foreground palettes at hues picked by scheme. Schemes with multiple accents register the first as accent and additional ones as accent-2, accent-3, ….
public static Theme ApplyAlgorithmicColorScheme(Theme theme, double hue, double chroma, CoordinatingScheme scheme)
;
/// Generates a vibrant foreground 11-step OKLCH palette. The 500 stop lands on chroma; other stops scale relative to it via the foreground chroma curve.
public static ImmutableDictionary<string, string> GenerateForeground(double hue, double chroma)
;
/// Generates a near-gray neutral 11-step OKLCH palette. Chroma scales by intensity (chroma / curve at 500) and the dark tail blends between tapered and held-high shapes via DarkChromaRetention.
public static ImmutableDictionary<string, string> GenerateNeutral(double hue, double chroma)
;
}