azalea-chat

Crates.ioazalea-chat
lib.rsazalea-chat
version0.10.3+mc1.21.1
sourcesrc
created_at2022-08-30 02:49:02.590266
updated_at2024-10-23 04:29:56.282712
descriptionParse Minecraft chat messages.
homepage
repositoryhttps://github.com/azalea-rs/azalea/tree/main/azalea-chat
max_upload_size
id654911
size68,734
mat (mat-1)

documentation

README

Azalea Chat

Things for working with Minecraft formatted text components.

Examples

// convert a Minecraft formatted text JSON into colored text that can be printed to the terminal.

use azalea_chat::FormattedText;
use serde_json::Value;
use serde::Deserialize;

let j: Value = serde_json::from_str(
    r#"{"text": "hello","color": "red","bold": true}"#
)
.unwrap();
let text = FormattedText::deserialize(&j).unwrap();
assert_eq!(
    text.to_ansi(),
    "\u{1b}[1m\u{1b}[38;2;255;85;85mhello\u{1b}[m"
);
Commit count: 0

cargo fmt