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.
| Field | Description | Required |
|---|---|---|
enchantment | A 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
| Field | Description | Default |
|---|---|---|
color | An integer representing an RBG color. Use a tool like shodor.org to convert an RGB value to an integer. | required |
bold | Bold style | false |
italic | Italic style | false |
underlined | Underlined style | false |
strikethrough | Strikethrough style | false |
obfuscated | Obfuscated style | false |
condition | An optional object containing conditions of when the above stylings will be applied. | none |
Condition
| Field | Description | Default |
|---|---|---|
value | Apply styling to a specific enchantment level | none |
min | Apply styling to a minimum enchantment level | none |
max | Apply styling to a maximum enchantment level | none |
Examples
Styling
Here is how to write a styling for an enchantment with Minecraft's different text styles:
{
"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:
{
"enchantment": "minecraft:protection",
"styles": [
{
"color": 16733525,
"conditions": { "value": 1 }
}
]
}To add more conditions, add more objects to the styles array like so:
{
"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:
{
"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:
{
"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:
{
"enchantment": "minecraft:protection",
"styles": [
{
"color": 16733525,
"conditions": {
"min": 2,
"max": 4
}
}
]
}