diff --git a/aseprite.c b/aseprite.c index 9c97b09..84561e8 100644 --- a/aseprite.c +++ b/aseprite.c @@ -70,10 +70,10 @@ JSValue js_aseprite_decode(JSContext *js, JSValue this_val, int argc, JSValueCon JSValue palette_array = JS_NewArray(js); for (int i = 0; i < ase->palette.entry_count; i++) { JSValue color = JS_NewObject(js); - JS_SetPropertyUint32(js, color, 0, JS_NewUint32(js, ase->palette.entries[i].color.r)); - JS_SetPropertyUint32(js, color, 1, JS_NewUint32(js, ase->palette.entries[i].color.g)); - JS_SetPropertyUint32(js, color, 2, JS_NewUint32(js, ase->palette.entries[i].color.b)); - JS_SetPropertyUint32(js, color, 3, JS_NewUint32(js, ase->palette.entries[i].color.a)); + JS_SetPropertyStr(js, color, "r", JS_NewUint32(js, ase->palette.entries[i].color.r)); + JS_SetPropertyStr(js, color, "g", JS_NewUint32(js, ase->palette.entries[i].color.g)); + JS_SetPropertyStr(js, color, "b", JS_NewUint32(js, ase->palette.entries[i].color.b)); + JS_SetPropertyStr(js, color, "a", JS_NewUint32(js, ase->palette.entries[i].color.a)); JS_SetPropertyUint32(js, palette_array, i, color); } JS_SetPropertyStr(js, result, "palette", palette_array);