Skip to content

Enchantment Text Styling Data Formats

Enchantment

Enchantment files defines the styles that will be applied to an enchantment's text. By default, this mod does not come with any datapacks, rather, it is up to the datapack or modpack creator, or the mod developer, to create these entires. These files are loaded from data/enchantment-text-color/styling/enchantment/[enchantment_name].json.

FieldDescriptionRequired
enchantmentA string for the identifier of an enchantment to apply styling to its text.Yes
styles An array of objects containing the styling information of an enchantment's text and the conditions of when it will be applied. Yes

Styles

FieldDescriptionDefault
colorAn integer representing an RBG color. Use a tool like shodor.org to convert an RGB value to an integer.required
boldBold stylefalse
italicItalic stylefalse
underlinedUnderlined stylefalse
strikethroughStrikethrough stylefalse
obfuscatedObfuscated stylefalse
conditionAn optional object containing conditions of when the above stylings will be applied.none

Condition

FieldDescriptionDefault
valueApply styling to a specific enchantment levelnone
minApply styling to a minimum enchantment levelnone
maxApply styling to a maximum enchantment levelnone

Examples

Styling

Here is how to write a styling for an enchantment with Minecraft's different text styles:

json
{
  "enchantment": "namespace:id",
  "styles": [
    {
      "color": 16733525,
      "bold": true,
      "italic": true,
      "underlined": true,
      "strikethrough": true,
      "obfuscated": true
    }
  ]
}

Specific Level

To change the color of Protection I to red, create a protection.json file and place it in data/enchantment-text-styling/styling/enchantment with the following data:

json
{
  "enchantment": "minecraft:protection",
  "styles": [
    {
      "color": 16733525,
      "conditions": { "value": 1 }
    }
  ]
}

To add more conditions, add more objects to the styles array like so:

json
{
  "enchantment": "minecraft:protection",
  "styles": [
    {
      "color": 16733525,
      "conditions": { "value": 1 }
    },
    {
      "color": 16755200,
      "conditions": { "value": 2 }
    }
  ]
}

This allows you to have one color for Protection I and a different color for Protection II!

Minimum Level

To change the color of Protection III or above, create a protection.json file and place it in data/enchantment-text-styling/styling/enchantment with the following data:

json
{
  "enchantment": "minecraft:protection",
  "styles": [
    {
      "color": 16733525,
      "conditions": { "min": 3 }
    }
  ]
}

Maximum Level

To change the color of Protection II or below, create a protection.json file and place it in data/enchantment-text-styling/styling/enchantment with the following data:

json
{
  "enchantment": "minecraft:protection",
  "styles": [
    {
      "color": 16733525,
      "conditions": { "max": 2 }
    }
  ]
}

Minimum and Maximum Level

To change the color of Protection II, III and IV to red if it is level 2 or above and level 4 or below, create a protection.json file and place it in data/enchantment-text-styling/styling/enchantment with the following data:

json
{
  "enchantment": "minecraft:protection",
  "styles": [
    {
      "color": 16733525,
      "conditions": { 
        "min": 2,
        "max": 4 
      }
    }
  ]
}