Use %02x when printing the palette. Otherwise setting it doesn't work
Reset palette on close