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 browserWhile reset will clear styles to equal chat-format.
Code-Blocks are only available within the browserAnother 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 browserInstead, 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 browserThe 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.
Color | Constant | Sequence |
---|---|---|
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 browserSince 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:
Color | Hex-Value | Example |
---|---|---|
#E8871E | Code-Blocks are only available within the browser | |
#6883BA | Code-Blocks are only available within the browser | |
#DD99BB | Code-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.
Format | Short | Example |
---|---|---|
bold | b &l | Code-Blocks are only available within the browserCode-Blocks are only available within the browser |
italic | i &o | Code-Blocks are only available within the browserCode-Blocks are only available within the browser |
underlined | u &n | Code-Blocks are only available within the browserCode-Blocks are only available within the browser |
strikethrough | st &m | Code-Blocks are only available within the browserCode-Blocks are only available within the browser |
obfuscated | obf &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, b: boolean(null)
↪ Whether to render contained text bold
italic, i: boolean(null)
↪ Whether to render contained text italic
underlined, u: boolean(null)
↪ Whether to underline contained text
strikethrough, st: boolean(null)
↪ Whether to strike contained text through
obfuscated, obf: boolean(null)
↪ Whether to obfuscate contained text
reset, r: boolean(false)
↪ Whether to apply a reset, back to the slot's default-style
font: string(null)
↪ Namespaced-key of the font to render contained text in
color: color(null)
↪ Color to apply to contained text
shadow: color(null)
↪ Shadow-color to apply to contained text
shadow-opacity: number(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 browserIf the value is to be driven by data, attribute-binding allows to assign expressions instead:
Code-Blocks are only available within the browserNext 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 browserBy 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 browserIn 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