1.1.0 • Published 4 years ago

mctext-react v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

mctext-react

This library allows you to display text with Minecraft formatting. It supports JSON (component-based) text as well as strings with formatting codes.
Obfuscated text is also supported and will behave as it does ingame.

Installation

npm i --save mctext-react

Usage

import McText from 'mctext-react'

<McText>§4red §lbold red §r§kobfuscated</McText>
<McText>
  {{
    text: '',
    extra: [
      {
        text: 'red ',
        color: 'dark_red'
      },
      {
        text: 'bold red ',
        bold: true,
        color: 'dark_red'
      },
      {
        text: 'obfuscated',
        obfuscated: true
      }
    ]
  }}
</McText>

Properties

NameTypeDefaultDescription
children *string or objectThe text to display, see above.
colormapobjectsee belowAn alternate colormap used to map Minecraft colors to CSS colors.
randomCharsstringA…Za…z0…9!§$%&?#Characters to use for obfuscated text.
prefixstring§Character to use for color prefix, usually § or &.
styleobjectOverride the style of the text.

* required property

Colormap

The sixteen Minecraft colors are mapped to CSS colors by using a colormap. The default colormap uses the colors from the Minecraft Wiki.

Related projects

  • McTextBlock is a WPF component that displays Minecraft formatted text. It only supports strings with formatting codes.

License

The files included in this repository are licensed under the MIT license.

1.1.0

4 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago