#[non_exhaustive]pub struct Style {
pub color: Option<TextColor>,
pub shadow_color: Option<u32>,
pub bold: Option<bool>,
pub italic: Option<bool>,
pub underlined: Option<bool>,
pub strikethrough: Option<bool>,
pub obfuscated: Option<bool>,
pub click_event: Option<ClickEvent>,
pub hover_event: Option<HoverEvent>,
pub insertion: Option<String>,
pub font: Option<String>,
}
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.color: Option<TextColor>
§shadow_color: Option<u32>
§bold: Option<bool>
§italic: Option<bool>
§underlined: Option<bool>
§strikethrough: Option<bool>
§obfuscated: Option<bool>
§click_event: Option<ClickEvent>
§hover_event: Option<HoverEvent>
§insertion: Option<String>
§font: Option<String>
Represented as a ResourceLocation
.
Implementations§
Source§impl Style
impl Style
pub fn new() -> Self
pub fn color(self, color: impl Into<Option<TextColor>>) -> Self
pub fn shadow_color(self, color: impl Into<Option<u32>>) -> Self
pub fn bold(self, bold: impl Into<Option<bool>>) -> Self
pub fn italic(self, italic: impl Into<Option<bool>>) -> Self
pub fn underlined(self, underlined: impl Into<Option<bool>>) -> Self
pub fn strikethrough(self, strikethrough: impl Into<Option<bool>>) -> Self
pub fn obfuscated(self, obfuscated: impl Into<Option<bool>>) -> Self
pub fn click_event(self, click_event: impl Into<Option<ClickEvent>>) -> Self
pub fn hover_event(self, hover_event: impl Into<Option<HoverEvent>>) -> Self
pub fn insertion(self, insertion: impl Into<Option<String>>) -> Self
pub fn font(self, font: impl Into<Option<String>>) -> Self
Source§impl Style
impl Style
pub fn empty() -> Self
pub fn deserialize(json: &Value) -> Style
Sourcepub fn compare_ansi(&self, after: &Style) -> String
pub fn compare_ansi(&self, after: &Style) -> String
find the necessary ansi code to get from this style to another
Sourcepub fn merged_with(&self, other: &Style) -> Style
pub fn merged_with(&self, other: &Style) -> Style
Returns a new style that is a merge of self and other.
For any field that other
does not specify (is None), self’s value is
used.
Sourcepub fn apply_formatting(&mut self, formatting: &ChatFormatting)
pub fn apply_formatting(&mut self, formatting: &ChatFormatting)
Apply a ChatFormatting to this style
pub fn get_html_style(&self) -> String
Trait Implementations§
Source§impl Serialize for Style
impl Serialize for Style
fn to_compound(self) -> NbtCompound
fn to_nbt(self) -> BaseNbt
impl StructuralPartialEq for Style
Auto Trait Implementations§
impl Freeze for Style
impl RefUnwindSafe for Style
impl Send for Style
impl Sync for Style
impl Unpin for Style
impl UnwindSafe for Style
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more