How to load hex file as palette via script?

Hi there,

I have saved palette from aseprite as .hex files, and now I would like to through scripting, load the .hex file as palette.

By looking at documentation, I did the following

local palette = Palette { fromFile = ‘colorPalette.hex’}

However it just returns nil.

The content of the hex file is just lines of colors like so
000000
232440
304e5a
61a79a
56797d
8da5a2
1d0d36
cbdbfc
46686c
37354d
38505f
2e566f
9ed3cd
7cb7ab
543747
ffffff
3f3f74

Any help would be appreciated

Hi @whipperino,

I just tried a quick test script. Does using a full file path make a difference? For example, local palette = Palette { fromFile = 'C:\\users\\myusername\\desktop\\colorPalette.hex' } .

app.fs contains file system helper tools. If you’re using a dialog, a file widget will allow the user choose a path.

Cheers,
Jeremy

2 Likes

Hello Jeremy @behreandtjeremy !

Thanks for your help in solving my problem, the problem indeed lies within the path and I didn’t realize that.

Thanks again for your resources.

1 Like