From a633db58925b2629c6adc2fd6fa2c9092cb6793e Mon Sep 17 00:00:00 2001 From: nots1dd Date: Wed, 8 Jan 2025 00:14:58 +0530 Subject: [PATCH] [MIN] Added more fields to colors in TOML parser --- src/parser/examples/config.toml | 4 +++- src/ui/colors.hpp | 6 +++++- src/ui/ui_handler.hpp | 10 ++++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/parser/examples/config.toml b/src/parser/examples/config.toml index 32879bb..30cedf2 100644 --- a/src/parser/examples/config.toml +++ b/src/parser/examples/config.toml @@ -35,4 +35,6 @@ play_this_song_next = "b" view_song_queue = "3" [colors] -active_win_color = "blue" +active_win_color = "Blue" +album_name_bg = "LightPink" +menu_cursor_bg = "LightYellow" diff --git a/src/ui/colors.hpp b/src/ui/colors.hpp index 611a4a0..0dea354 100644 --- a/src/ui/colors.hpp +++ b/src/ui/colors.hpp @@ -157,6 +157,8 @@ ftxui::Color GetColor(Color color) struct InLimboColors { TrueColors::Color active_win_color; + TrueColors::Color album_name_bg; + TrueColors::Color menu_cursor_bg; }; // Function to map color strings from TOML to the enum @@ -225,7 +227,9 @@ InLimboColors parseColors() // Mapping of fields in the InLimboColors struct const std::unordered_map field_map = { - {"active_win_color", &colors.active_win_color}}; + {"active_win_color", &colors.active_win_color}, + {"album_name_bg", &colors.album_name_bg}, + {"menu_cursor_bg", &colors.menu_cursor_bg}}; for (const auto& [field, member_color] : field_map) { diff --git a/src/ui/ui_handler.hpp b/src/ui/ui_handler.hpp index 8c385ec..b948c18 100644 --- a/src/ui/ui_handler.hpp +++ b/src/ui/ui_handler.hpp @@ -6,16 +6,12 @@ #include "keymaps.hpp" #include "misc.hpp" #include -#include #include #include -#include #include using namespace ftxui; -#define ALBUM_DELIM "----------- " - /* MACROS FOR SONG DETAILS */ #define STATUS_PLAYING "<>" #define STATUS_PAUSED "!!" @@ -375,7 +371,7 @@ class MusicPlayer // Get year from the first song in the album const Song& first_song = discs.begin()->second.begin()->second; current_song_elements.push_back( - renderAlbumName(album_name, first_song.metadata.year, TrueColors::Color::LightGray)); + renderAlbumName(album_name, first_song.metadata.year, global_colors.album_name_bg)); album_name_indices.insert(current_song_elements.size() - 1); for (const auto& [disc_number, tracks] : discs) @@ -488,6 +484,8 @@ class MusicPlayer return &song_queue[current_song_queue_index]; } + dialog_message = "Something went worng"; + show_dialog = true; return nullptr; } @@ -547,7 +545,7 @@ class MusicPlayer [&]() mutable { return RenderSongMenu(current_song_elements, &selected_inode, - TrueColors::Color::LightYellow); // This should return an Element + global_colors.menu_cursor_bg); // This should return an Element }); auto main_container = Container::Horizontal({artists_list, songs_list});