This page is about the JSON in Mantle assigning colors to various resources. For the common JSON format for a color, see Basic Types.

Since 1.18.2, mods using Mantle can assign colors to a component in JSON. This is most commonly used for the colors of tooltip strings, since methods for setting tooltip colors via language files are both unreliable and limited in options.

Color Format

Colors are defined in resource packs under assets/<domain>/mantle/color.json. The domain <domain> has no impact on the behavior of the JSON, it is simply used to allow multiple mods to define a color list without conflicting (as before 1.19.4 Forge did not allow multiple mods to define a resource at the same location in resource packs). In addition, between 1.18 and 1.20 this file can also be loaded from assets/<domain>/tinkering/color.json, though it will generate a log warning directing users to the new location.

The color JSON has the following format:

  • (Object): A color object.
    • <key> (Text Color): Assigns the key <key> to the given color. If null, will be skipped (useful for comments).
    • <prefix> (Object): Recursive definition of a color object. All keys inside the object will be prefixed with <prefix>..
      • <key> (Text Color): Assigns the key <prefix>.<key> to the given color. If null, will be skipped (useful for comments).
      • <prefix2> (Object): Recursive definition of a color object. All keys inside the object will be prefixed with <prefix>.<prefix2>..
        • <key> (Text Color): Assigns the key <prefix>.<prefix2>.<key> to the given color. If null, will be skipped (useful for comments).
        • May additionally nest any number of prefixes.

Example

The key example.color.key may be set to #123456 using any of the following formats:

{
    "some.comment": null,
    "example.color.key": "#123456"
}
{
    "example": {
        "color.key": "#123456"
    }
}
{
    "example.color": {
        "key": "#123456"
    }
}
{
    "example": {
        "color": {
            "key": "#123456"
        }
    }
}

These formats may be freely mixed throughout the file, though note that the same JSON key cannot be defined as both a color and a color object. In other words, if trying to set both example.color and example.color.key, the following is allowed:

{
    "example": {
        "color": "#123456",
        "color.key": "#123456"
    }
}

but the following is not allowed:

{
    "example": {
        "color": "#123456",
        "color": {
            "key": "#123456"
        }
    }
}

Usages

Tinkers’ Construct uses the resource color list with the following keys:

  • The modifier <domain>:<name> defines its text color using the key modifier.<domain>.<name>.
  • The material <domain>:<name> defines its text color using the key material.<domain>.<name>.
  • The material variant <domain>:<name>#<variant> defines its text color using the key material.<domain>.<name>.<variant>.
  • The mining tier <domain>:<name> defines its text color using the key harvest_tier.<domain>.<name>.