Struct css_style::text::Text [−][src]
pub struct Text {Show 19 fields
pub color: Option<Color>,
pub direction: Option<Direction>,
pub letter_spacing: Option<LetterSpacing>,
pub word_spacing: Option<WordSpacing>,
pub line_height: Option<LineHeight>,
pub align: Option<TextAlign>,
pub align_last: Option<TextAlignLast>,
pub justify: Option<TextJustify>,
pub shadow: Option<TextShadow>,
pub indent: Option<TextIndent>,
pub decoration: Option<TextDecoration>,
pub white_space: Option<WhiteSpace>,
pub unicode_bidi: Option<UnicodeBidi>,
pub transform: Option<TextTransform>,
pub overflow: Option<TextOverflow>,
pub vertical_align: Option<VerticalAlign>,
pub writing_mode: Option<WritingMode>,
pub word_wrap: Option<WordWrap>,
pub word_break: Option<WordBreak>,
}
Expand description
use css_style::{Style, color, unit::{em, px}, text::{TextAlign, TextTransform}};
use palette::rgb::Rgb;
Style::default()
.and_text(|conf| {
conf.line_height(1.7)
// rgb value f32 based, we can pass u32 hex value too e.g. 0xFFFFFFFF
.color((0.5, 0.1, 0.1))
// or we can use HTML colors
.color(color::named::BLUEVIOLET)
.align(TextAlign::Center)
.transform(TextTransform::Capitalize)
.indent(em(2.))
// for single text shadow
.and_shadow(|conf| {
conf.x(px(3))
.y(px(4))
.color(color::named::BLUE)
.blur(px(2))
})
// for multiple text shadows
.and_shadow(|conf| {
conf.push(|conf| conf.x(px(2))).y(px(-4))
.push(|conf| conf.x(px(9)))
})
});
Fields
color: Option<Color>
direction: Option<Direction>
letter_spacing: Option<LetterSpacing>
word_spacing: Option<WordSpacing>
line_height: Option<LineHeight>
align: Option<TextAlign>
align_last: Option<TextAlignLast>
justify: Option<TextJustify>
shadow: Option<TextShadow>
indent: Option<TextIndent>
decoration: Option<TextDecoration>
white_space: Option<WhiteSpace>
unicode_bidi: Option<UnicodeBidi>
transform: Option<TextTransform>
overflow: Option<TextOverflow>
vertical_align: Option<VerticalAlign>
writing_mode: Option<WritingMode>
word_wrap: Option<WordWrap>
word_break: Option<WordBreak>
Implementations
pub fn and_shadow(
self,
set_value: impl FnOnce(TextShadow) -> TextShadow
) -> Self where
TextShadow: Default,
pub fn and_decoration(
self,
set_value: impl FnOnce(TextDecoration) -> TextDecoration
) -> Self where
TextDecoration: Default,
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Text
impl UnwindSafe for Text
Blanket Implementations
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
Mutably borrows from an owned value. Read more
Convert into T with values clamped to the color defined bounds Read more
Convert into T. The resulting color might be invalid in its color space Read more
Convert into T, returning ok if the color is inside of its defined
range, otherwise an OutOfBounds
error is returned which contains
the unclamped color. Read more