Minecraft – use command blocks to /give me an item with a coloured name?

minecraft-commandsminecraft-java-edition

Lots of questions from me today. Here is my command so far:

/give @p minecraft:writable_book 1 0 {pages:[""],display:{Name:"Command Book",color:purple}}

I want a simple command book but I'd like it to look nice, with a colored name for when I hover over it in my inventory. I have tried and tried and searched the internet, but without third party sources I cant find a way to spawn it with a colored name within a command block. Can anyone help?

Best Answer

You'll need to use some external world editor capable of editing a block's NBT data. For example, MCEdit.

Open up the command block's data (method varies by tool; with MCEdit, run the "NBT Edit" filter with the command block selected):

NBT Editor

Then, in the "Command" string, paste in a section sign (ยง) followed by a formatting code corresponding to the colour you want right before the text you want coloured:

NBT Editor editing a tag

When you go back into the game, the command in the block should look like this:

Coloured command in a command block

And give books that look like this:

enter image description here