mirror of
https://github.com/figsoda/mmtc
synced 2024-11-22 15:13:03 +00:00
ability to add or remove modifiers from text
This commit is contained in:
parent
70e8ddbe94
commit
3221fcf1de
3 changed files with 78 additions and 6 deletions
10
mmtc.ron
10
mmtc.ron
|
@ -9,19 +9,19 @@ Config(
|
|||
Min(0, Queue(
|
||||
columns: [
|
||||
Ratio(12, If(Selected,
|
||||
Styled([Fg(Black), Bg(Indexed(117))], QueueTitle),
|
||||
Styled([Fg(Black), Bg(Indexed(117)), Bold], QueueTitle),
|
||||
Styled([Fg(Indexed(117))], QueueTitle),
|
||||
)),
|
||||
Ratio(10, If(Selected,
|
||||
Styled([Fg(Black), Bg(Indexed(111))], QueueArtist),
|
||||
Styled([Fg(Black), Bg(Indexed(111)), Bold], QueueArtist),
|
||||
Styled([Fg(Indexed(111))], QueueArtist),
|
||||
)),
|
||||
Ratio(10, If(Selected,
|
||||
Styled([Fg(Black), Bg(Indexed(105))], QueueTitle),
|
||||
Styled([Fg(Indexed(105))], QueueTitle),
|
||||
Styled([Fg(Black), Bg(Indexed(105)), Bold], QueueAlbum),
|
||||
Styled([Fg(Indexed(105))], QueueAlbum),
|
||||
)),
|
||||
Ratio(1, If(Selected,
|
||||
Styled([Fg(Black), Bg(Indexed(177))], QueueDuration),
|
||||
Styled([Fg(Black), Bg(Indexed(177)), Bold], QueueDuration),
|
||||
Styled([Fg(Indexed(177))], QueueDuration),
|
||||
)),
|
||||
],
|
||||
|
|
|
@ -63,6 +63,24 @@ pub enum Texts {
|
|||
pub enum AddStyle {
|
||||
Fg(Color),
|
||||
Bg(Color),
|
||||
Bold,
|
||||
NoBold,
|
||||
Dim,
|
||||
NoDim,
|
||||
Italic,
|
||||
NoItalic,
|
||||
Underlined,
|
||||
NoUnderlined,
|
||||
SlowBlink,
|
||||
NoSlowBlink,
|
||||
RapidBlink,
|
||||
NoRapidBlink,
|
||||
Reversed,
|
||||
NoReversed,
|
||||
Hidden,
|
||||
NoHidden,
|
||||
CrossedOut,
|
||||
NoCrossedOut,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use tui::{
|
||||
backend::Backend,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
style::Style,
|
||||
style::{Modifier, Style},
|
||||
text::{Span, Spans},
|
||||
widgets::{List, ListItem, ListState, Paragraph},
|
||||
Frame,
|
||||
|
@ -278,6 +278,60 @@ fn flatten(
|
|||
AddStyle::Bg(color) => {
|
||||
style.bg = Some(*color);
|
||||
}
|
||||
AddStyle::Bold => {
|
||||
style = style.add_modifier(Modifier::BOLD);
|
||||
}
|
||||
AddStyle::NoBold => {
|
||||
style = style.remove_modifier(Modifier::BOLD);
|
||||
}
|
||||
AddStyle::Dim => {
|
||||
style = style.add_modifier(Modifier::DIM);
|
||||
}
|
||||
AddStyle::NoDim => {
|
||||
style = style.remove_modifier(Modifier::DIM);
|
||||
}
|
||||
AddStyle::Italic => {
|
||||
style = style.add_modifier(Modifier::ITALIC);
|
||||
}
|
||||
AddStyle::NoItalic => {
|
||||
style = style.remove_modifier(Modifier::ITALIC);
|
||||
}
|
||||
AddStyle::Underlined => {
|
||||
style = style.add_modifier(Modifier::UNDERLINED);
|
||||
}
|
||||
AddStyle::NoUnderlined => {
|
||||
style = style.remove_modifier(Modifier::UNDERLINED);
|
||||
}
|
||||
AddStyle::SlowBlink => {
|
||||
style = style.add_modifier(Modifier::SLOW_BLINK);
|
||||
}
|
||||
AddStyle::NoSlowBlink => {
|
||||
style = style.remove_modifier(Modifier::SLOW_BLINK);
|
||||
}
|
||||
AddStyle::RapidBlink => {
|
||||
style = style.add_modifier(Modifier::RAPID_BLINK);
|
||||
}
|
||||
AddStyle::NoRapidBlink => {
|
||||
style = style.remove_modifier(Modifier::RAPID_BLINK);
|
||||
}
|
||||
AddStyle::Reversed => {
|
||||
style = style.add_modifier(Modifier::REVERSED);
|
||||
}
|
||||
AddStyle::NoReversed => {
|
||||
style = style.remove_modifier(Modifier::REVERSED);
|
||||
}
|
||||
AddStyle::Hidden => {
|
||||
style = style.add_modifier(Modifier::HIDDEN);
|
||||
}
|
||||
AddStyle::NoHidden => {
|
||||
style = style.remove_modifier(Modifier::HIDDEN);
|
||||
}
|
||||
AddStyle::CrossedOut => {
|
||||
style = style.add_modifier(Modifier::CROSSED_OUT);
|
||||
}
|
||||
AddStyle::NoCrossedOut => {
|
||||
style = style.remove_modifier(Modifier::CROSSED_OUT);
|
||||
}
|
||||
}
|
||||
}
|
||||
flatten(
|
||||
|
|
Loading…
Reference in a new issue