azalea/azalea-chat/README.md

24 lines
516 B
Markdown
Raw Normal View History

2022-04-20 15:24:25 +00:00
# Azalea Chat
2023-01-30 22:05:18 +00:00
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"
);
```