37 lines
846 B
Rust
37 lines
846 B
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
/// Text color
|
|
#[derive(Default, Debug, Clone, Copy, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum Color {
|
|
/// The default color for the text will be used, which varies by context
|
|
/// (in some cases, it's white; in others, it's black; in still others, it
|
|
/// is a shade of gray that isn't normally used on text).
|
|
#[default]
|
|
Reset,
|
|
/// One of the 16 named Minecraft colors
|
|
Named(NamedColor),
|
|
}
|
|
|
|
/// Named Minecraft color
|
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum NamedColor {
|
|
Black = 0,
|
|
DarkBlue,
|
|
DarkGreen,
|
|
DarkAqua,
|
|
DarkRed,
|
|
DarkPurple,
|
|
Gold,
|
|
Gray,
|
|
DarkGray,
|
|
Blue,
|
|
Green,
|
|
Aqua,
|
|
Red,
|
|
LightPurple,
|
|
Yellow,
|
|
White,
|
|
}
|