Color32JsonConverter
- Namespace: Turian.Engine.Core
- Source File: Color32JsonConverter.cs
(De)serializes Color32 as "#RRGGBBAA" rather than its packed uint field, which is readonly and has no settable member STJ can bind to — without this converter, a Color32 round-trips as transparent black. A hex string is also reviewable in a scene-file diff, unlike an opaque packed integer.
Public Methods
Read
public override Color32 Read(Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
Parameters:
reader(Utf8JsonReader)typeToConvert(Type)options(JsonSerializerOptions)
Returns: Color32
Write
public override void Write(Utf8JsonWriter writer, Color32 value, JsonSerializerOptions options)
Parameters:
writer(Utf8JsonWriter)value(Color32)options(JsonSerializerOptions)