tramhao / termusic

Music Player TUI written in Rust
GNU General Public License v3.0
962 stars 42 forks source link

Customizable popup message colors #314

Closed myypo closed 3 weeks ago

myypo commented 2 months ago

Describe what you want

It would have been handy to be able to change popup colors: foreground, background and border.

Do you have already an idea for the implementation?

At the moment popup colors are hardcoded.

impl MessagePopup {
    pub fn new<S: AsRef<str>>(title: S, msg: S) -> Self {
        Self {
            component: Paragraph::default()
                .borders(
                    Borders::default()
                        .color(Color::Cyan)
                        .modifiers(BorderType::Rounded),
                )
                .foreground(Color::Green)
                // .background(Color::Black)
                .modifiers(TextModifiers::BOLD)
                .alignment(Alignment::Center)
                .title(title, Alignment::Center)
                .text(vec![TextSpan::from(msg.as_ref().to_string())].as_slice()),
        }
    }
}

But it should not be difficult to make them as customizable as the other parts of UI.

If you are okay with it, I can implement this feature a little bit later. My proposed new config options are: popup_foreground, popup_background and popup_border.

hasezoey commented 2 months ago

i already have done this for config v2, though i guess it could be added to config v1 too. (also i am still working on config v2 so it is not posted yet)

myypo commented 2 months ago

i already have done this for config v2, though i guess it could be added to config v1 too. (also i am still working on config v2 so it is not posted yet)

Thanks! Would rather wait for your implementation then.

Have seen your topic in discussion but missed these fields:

important_popup_foreground = "Red"
important_popup_background = "Reset"
important_popup_border = "Red"

Will keep the issue open for reference.

hasezoey commented 2 months ago

just note that the important_popup_* fields are meant for, well, important popups like Error, Delete, etc; other popups (or generic single use things) i had added generic_* fields (because previously in v1 they rely on library_* fields)

hasezoey commented 2 months ago

well instead of waiting for v2, i have now added the important_popup fields to config v1 (along some other changes) in #315

hasezoey commented 3 weeks ago

The Config V1 had added some customizable popup colors via #315, and now config v2 has been added #319 and switched over to via #331, does this address this issue enough @myypo?

myypo commented 3 weeks ago

The Config V1 had added some customizable popup colors via #315, and now config v2 has been added #319 and switched over to via #331, does this address this issue enough @myypo?

Yes, closing it now, thank you.