feat!: SPEC_2026, SchemeCmf, and PaletteStyle sealed interface#491
Open
feat!: SPEC_2026, SchemeCmf, and PaletteStyle sealed interface#491
Conversation
Primary constructor now takes List<Hct> instead of single Hct. sourceColorHct is derived as the first element. Updated from() to pass the list, and maybeFallbackSpecVersion to handle CMF (passes through) and downgrade SPEC_2026 to SPEC_2025 for non-CMF variants.
Changed Builder.extendSpecVersion from == to >= so that SPEC_2026 correctly activates both 2025 and 2026 color extensions in the layered spec system. Added top-level DynamicColor.extendSpecVersion() extension function for cleaner usage in ColorSpec implementations.
- ColorSpecs: add SPEC_2026 instance routing - MaterialDynamicColors: default colorSpec changed to ColorSpec2026 - ColorSpec2021: add else throw for unsupported CMF variant in palettes - ColorSpec2025: make class open to allow ColorSpec2026 extension
ColorSpec2026 extends ColorSpec2025 with CMF-specific surface tones, chroma multipliers, tMaxC/tMinC helpers, conditional on-fixed backgrounds (tone > 57), *Dim remapping, and phone-platform-gated toneDeltaPairs. SchemeCmf supports dual source colors via sourceColorHctList with dynamic error hue lookup and tertiary palette from second source.
Add SPEC_2026 to upstream Java ColorSpec enum and update test mapping to prevent exhaustive when-expression compile errors.
CMF works with a single seed color (tertiary falls back to primary). For dual source color support, use SchemeCmf directly.
Updates to the latest upstream commit which includes the 2026 spec and CMF variant. Test now maps SPEC_2026 instead of skipping it.
…support PaletteStyle is now a sealed interface with data objects for existing styles and a @poko class for Cmf that accepts an optional tertiarySourceColor. This lets users pass a second source color through the high-level Compose API instead of needing SchemeCmf directly. Updates README with migration guide, CMF docs, and SPEC_2026 info.
Owner
Author
Code reviewFound 2 issues:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SchemeCmffor the CMF (Color, Material, Finish) dual-source color schemePaletteStylefrom an enum to a sealed interface — existing styles becomedata objects,Cmfbecomes a@Poko classwith an optionaltertiarySourceColor: Color?parameterPaletteStyle.Cmf(tertiarySourceColor = Color.Blue)) instead of needingSchemeCmfdirectly5.0.0-alpha) moves to6.xBreaking changes
PaletteStyleis a sealed interface, not an enum —PaletteStyle.entries/values()no longer existPaletteStyle.Cmfis now a class (constructed withPaletteStyle.Cmf()) instead of an enum entryDynamicSchemeconstructor acceptssourceColorHctList(existing single-source constructors still work)Test plan
./gradlew :material-kolor:jvmTestpasses