Skip to main content

Style

Specifys the enclosed content's style, being either enabled, disabled or unset (default, as dictated by the component-slot rendered into).

Reset

By definition, resetting resets style only, meaning formats (bold, italic, etc.), as well as color, shadow-color and font (click- and hover-events are not affected, by design!). In essence, it affects all properties of the Code-Blocks are only available within the browser-tag documented on this page, which is why the Code-Blocks are only available within the browser-tag also resides here; think of it as the successor to its legacy equivalent Code-Blocks are only available within the browser, which also immediately dictates what will be reset to: chat-style, meaning white color, no formats as well as default font and shadow.

The above is the only future-proof definition of resetting style, as various component-slots come with differing implicit default styles, e.g. Code-Blocks are only available within the browser formatting and Code-Blocks are only available within the browser color on lore-lines. Mojang may change these up in the future and can, at any release, introduce new default-styles for other slots. Implicitly resetting by default in order to level the playing-field is not an option either, as some users may want to take advantage of these default formats; choosing to make it be an explicit action to normalize style thus enables all participants to be able to express their rendering desires.

A lore-line without reset looks as follows

Code-Blocks are only available within the browser

While reset will clear styles to equal chat-format.

Code-Blocks are only available within the browser

Another use-case for resetting style is to inject differently styled content without having to re-specify the formats for all other parts; let's look at the less-clean version first.

Code-Blocks are only available within the browser

Instead, in order to inject an independent part, simply invoke Code-Blocks are only available within the browser, without having to exit the surrounding style; while we're at it, let's also use the shorthand name Code-Blocks are only available within the browser.

Code-Blocks are only available within the browser

The system is aware of which slot a component is rendered into and thereby also knows its default style, which is why Code-Blocks are only available within the browser will only ever emit the style-properties absolutely necessary and is not adding any additional weight to the final output component.

Color Shorthands

Specifies the enclosed content's color. When evaluating components on an older version, unsupported colors (e.g. hexadecimal) will be converted to known constants, thereby supporting a broad range of versions without having to compromise on modern features.

Both the vanilla set of Minecraft's legacy-colors as well as all hexadecimal values may be used as shorthand tag-names.

For the sake of brevity, while ensuring compatibility and familiarity, both the constant-names and the ubiquitous ampersand-sequences are supported; keep in mind that the latter also uses tag-notation, as to unify syntax and stick to the new standard.

ColorConstantSequence
green&a
aqua&b
red&c
light_purple&d
yellow&e
white&f
black&0
dark_blue&1
dark_green&2
dark_aqua&3
dark_red&4
dark_purple&5
gold&6
gray&7
dark_gray&8
blue&9

To be used as follows:

Code-Blocks are only available within the browser Code-Blocks are only available within the browser

Since Minecraft version Code-Blocks are only available within the browser, hexadecimal colors are now fully supported, enabling the user to access the whole realm of 16.7 million new values. In order to specify such colors, use the pattern Code-Blocks are only available within the browser as a tag-name, used as follows:

ColorHex-ValueExample
#E8871ECode-Blocks are only available within the browser
#6883BACode-Blocks are only available within the browser
#DD99BBCode-Blocks are only available within the browser

Format Shorthands

Both the full format as well as it's shorthand may be used as tag-names (also supporting the ubiquitous ampersand-sequences); prepend a bang in order to disable this style (and don't forget to mirror it in the closing-tag too!). For most cases, the positive version of each tag will suffice.

FormatShortExample
boldb

&l
Code-Blocks are only available within the browserCode-Blocks are only available within the browser
italici

&o
Code-Blocks are only available within the browserCode-Blocks are only available within the browser
underlinedu

&n
Code-Blocks are only available within the browserCode-Blocks are only available within the browser
strikethroughst

&m
Code-Blocks are only available within the browserCode-Blocks are only available within the browser
obfuscatedobf

&k
Code-Blocks are only available within the browserCode-Blocks are only available within the browser

Explicit Tag

Overview

While there are shorthand-tags for formats and colors, the explicit Code-Blocks are only available within the browser-tag comes in handy whenever style is to be driven by data dynamically, or special properties like the Code-Blocks are only available within the browser or the Code-Blocks are only available within the browser are to be controlled.

<style

  bold, bboolean(null)

  ↪ Whether to render contained text bold

  italic, iboolean(null)

  ↪ Whether to render contained text italic

  underlined, uboolean(null)

  ↪ Whether to underline contained text

  strikethrough, stboolean(null)

  ↪ Whether to strike contained text through

  obfuscated, obfboolean(null)

  ↪ Whether to obfuscate contained text

  reset, rboolean(false)

  ↪ Whether to apply a reset, back to the slot's default-style

  fontstring(null)

  ↪ Namespaced-key of the font to render contained text in

  colorcolor(null)

  ↪ Color to apply to contained text

  shadowcolor(null)

  ↪ Shadow-color to apply to contained text

  shadow-opacitynumber(null)

  ↪ Opacity of the applied shadow-color, if any

>markup</>

Examples

To set a font, simply assign the corresponding attribute to the desired string:

Code-Blocks are only available within the browser

If the value is to be driven by data, attribute-binding allows to assign expressions instead:

Code-Blocks are only available within the browser

Next to specifying style statically or dynamically, one may also employ this tag in order to toggle multiple styles dynamically, by leveraging the intrinsic Code-Blocks are only available within the browser-attribute:

Code-Blocks are only available within the browser

By default, shadow-colors reside at around 25% opacity and, with modern versions of minecraft, default to the color of the text (or black if the text-color ends up being white):

Code-Blocks are only available within the browser

In order to increase the shadow's visibility, let's ramp it all the way up for a change.

Code-Blocks are only available within the browser