minecraftminecraft-commands

What colour format is used in command block commands?


I just started using command blocks in Minecraft and I'm stuck. I'm trying to make a custom firework rocket colour with this command.

give @p minecraft:firework_rocket{
    Fireworks:{
        Flight:2,
        Explosions:[{
            Type:1,
            Flicker:0,
            Trail:1,
            Colors:[I;86219204], // What is this colour format?
            FadeColors:[I;16886219] // same here
        }]
    }
} 1

I have tried with HEX and RGB and it doesn't seem like it's any of those. For reference I;2651799 is cyan; I;1973019 is black; and I;15790320 is white.

I used this page to check these values by just ticking the boxes in the Select the Explosion Colors section, generating the command, and checking the value.

Thanks for your help,
Huky


Solution

  • I have tried with HEX and RGB and it doesn't seem like it's any of those.

    But it is! Colors specified through NBT use the hex format (#RRGGBB). However, Minecraft's NBT parser does not support hexadecimal numbers, only base 10. So this means you have to convert between base 10 and hex. For example, the color #FF0000 in hex is 16711680 in base 10!