Skip to content

Commit ab9cd9d

Browse files
Added blink fast and strikethrough attributes (#159)
Co-authored-by: Armin Ronacher <armin.ronacher@active-4.com>
1 parent 7c7a7d9 commit ab9cd9d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/utils.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,10 @@ pub enum Attribute {
122122
Italic,
123123
Underlined,
124124
Blink,
125+
BlinkFast,
125126
Reverse,
126127
Hidden,
128+
StrikeThrough,
127129
}
128130

129131
impl Attribute {
@@ -135,8 +137,10 @@ impl Attribute {
135137
Attribute::Italic => 3,
136138
Attribute::Underlined => 4,
137139
Attribute::Blink => 5,
140+
Attribute::BlinkFast => 6,
138141
Attribute::Reverse => 7,
139142
Attribute::Hidden => 8,
143+
Attribute::StrikeThrough => 9,
140144
}
141145
}
142146
}
@@ -214,8 +218,10 @@ impl Style {
214218
"dim" => rv.dim(),
215219
"underlined" => rv.underlined(),
216220
"blink" => rv.blink(),
221+
"blink_fast" => rv.blink_fast(),
217222
"reverse" => rv.reverse(),
218223
"hidden" => rv.hidden(),
224+
"strikethrough" => rv.strikethrough(),
219225
on_c if on_c.starts_with("on_") => {
220226
if let Ok(n) = on_c[3..].parse::<u8>() {
221227
rv.on_color256(n)
@@ -396,13 +402,21 @@ impl Style {
396402
self.attr(Attribute::Blink)
397403
}
398404
#[inline]
405+
pub fn blink_fast(self) -> Style {
406+
self.attr(Attribute::BlinkFast)
407+
}
408+
#[inline]
399409
pub fn reverse(self) -> Style {
400410
self.attr(Attribute::Reverse)
401411
}
402412
#[inline]
403413
pub fn hidden(self) -> Style {
404414
self.attr(Attribute::Hidden)
405415
}
416+
#[inline]
417+
pub fn strikethrough(self) -> Style {
418+
self.attr(Attribute::StrikeThrough)
419+
}
406420
}
407421

408422
/// Wraps an object for formatting for styling.
@@ -586,13 +600,21 @@ impl<D> StyledObject<D> {
586600
self.attr(Attribute::Blink)
587601
}
588602
#[inline]
603+
pub fn blink_fast(self) -> StyledObject<D> {
604+
self.attr(Attribute::BlinkFast)
605+
}
606+
#[inline]
589607
pub fn reverse(self) -> StyledObject<D> {
590608
self.attr(Attribute::Reverse)
591609
}
592610
#[inline]
593611
pub fn hidden(self) -> StyledObject<D> {
594612
self.attr(Attribute::Hidden)
595613
}
614+
#[inline]
615+
pub fn strikethrough(self) -> StyledObject<D> {
616+
self.attr(Attribute::StrikeThrough)
617+
}
596618
}
597619

598620
macro_rules! impl_fmt {

0 commit comments

Comments
 (0)