Created
November 11, 2020 13:42
-
-
Save dacap/cb52f101b58cc5201b9149c8b1f3dd3e to your computer and use it in GitHub Desktop.
Export the palette of the active sprite to STDOUT as a C array
This file contains 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
-- Usage: aseprite.exe -b my-sprite.aseprite -script export-palette.lua | |
-- | |
-- Or from the UI you will see the output in a console that you can copy with Ctrl+C | |
-- | |
local spr = app.activeSprite | |
if not spr then return print("No active sprite") end | |
local pal = spr.palettes[1] | |
print("const char palette[] = {") | |
for i = 0,#pal-1 do | |
local c = pal:getColor(i) | |
print(string.format(" %d, %d, %d, %d,", c.red, c.green, c.blue, c.alpha)) | |
end | |
print("}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment