Color Unchained is a simple mod which allows you to use Minecraft color formatting in different text areas around the game. This includes the chatbox, anvil names, written books, and signs.
In the 4 relevant GUIs, you'll see a small RGB button in the top left of your screen:
Click it to reveal color options along with different formatting types!
Once you've clicked on the color you want, start typing. You can also use multiple colors and styles in a single message:
Signs can be colored in a similar fashion:
Want a cool weapon? How about a non-italicized colored name?
Books are a beta feature and you may find bugs with it.
If you don't want to use the color button in the chat screen, you can use %% as a replacement for the color format key.
Thanks to everyone on the Fabric discord who helped with hunting down a solution to this issue, as well as the people who helped me with several bugs!
GPLv3. You can do what you want with the mod and the code used to run it.