PaletteStyleSerializer

object PaletteStyleSerializer : KSerializer<PaletteStyle>

Writes a PaletteStyle as a single string, so it works with every kotlinx format, Json, Cbor, protobuf and the rest, and with formats that only accept primitives for map keys.

The nine objects serialize under the names the old enum used, "TonalSpot" and its siblings, so documents written against 5.x still read. A PaletteStyle.Cmf carries its tertiary seed color along as Cmf:AARRGGBB, and one without a seed is plain "Cmf".

PaletteStyle is annotated with this serializer, so Json.encodeToString(style) picks it up on its own. Reading a string no style answers to fails with a SerializationException.

Properties

Link copied to clipboard
open override val descriptor: SerialDescriptor

Functions

Link copied to clipboard
open override fun deserialize(decoder: Decoder): PaletteStyle
Link copied to clipboard
open override fun serialize(encoder: Encoder, value: PaletteStyle)