azalea/azalea-chat
2023-01-30 22:05:18 +00:00
..
src have docs for all crates 2023-01-30 22:05:18 +00:00
tests change to_ansi to not take args 2022-12-04 20:58:14 -06:00
Cargo.toml Allow using azalea-chat without azalea-buf to avoid unstable features (#58) 2023-01-20 15:31:02 -06:00
README.md have docs for all crates 2023-01-30 22:05:18 +00:00

Azalea Chat

Things for working with Minecraft formatted text components.

Examples

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

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

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