[PR #118] [MERGED] More flexible theme config #634

Closed
opened 2026-03-02 23:49:08 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/aome510/spotify-player/pull/118
Author: @daschw
Created: 2/3/2023
Status: Merged
Merged: 2/3/2023
Merged by: @aome510

Base: masterHead: theme


📝 Commits (6)

  • daf93ef Allow specifying only some of the component styles in theme.toml
  • bb9d1e7 Don't require palette in theme config
  • 2c72820 Implement border component style
  • 7f31fd5 Implement selection component style
  • 591568d Implement review suggestions
  • 54f8541 update example theme config file and theme_parse script

📊 Changes

8 files changed (+157 additions, -90 deletions)

View changed files

📝 docs/config.md (+7 -3)
📝 examples/theme.toml (+10 -0)
📝 scripts/theme_parse (+2 -0)
📝 spotify_player/src/config/theme.rs (+119 -78)
📝 spotify_player/src/ui/page.rs (+6 -3)
📝 spotify_player/src/ui/playback.rs (+2 -1)
📝 spotify_player/src/ui/popup.rs (+7 -3)
📝 spotify_player/src/ui/utils.rs (+4 -2)

📄 Description

Hi, thanks for this awesome piece of software!

I just recently came across this project and played around with the theme config a little. At some point I thought it would be nice to have darker borders. However, I could not find this option anywhere in the component styles. So I thought I'd try to implement this myself. After I had finished, I realized that this would require every user to update their theme.toml files because without the new border option spotify_player would not be able to parse them and error. Furthermore I saw that you recently refactored the theming config and deleted fg_selected and bg_selected (or how they were called) and I saw the TODO comment to find a solution to not having to set each component style when adding this section in theme.toml.

Hence I thought, before I add an option to change the border I'll try to figure out a way to solve this TODO. Afterwards, adding new component styles would not be an issue, because it would not affect older configs, that did not set this attribute. So that is what I ended up doing. With this PR

  • it is possible to only set some of the component styles in theme.toml
  • it is possible to not set the palette in theme.toml (and just modify component styles)
  • it is possible to set the border style with the new component_style attribute border
  • it is possible to set the style of the current selection with the new component_style selection

I am quite sure that none of these changes affect any existing theme configs.

With this I could now have a theme.toml like this

[[themes]]
name = "mine"
[themes.component_style]
border = { fg = "BrightBlack" }
selection = { fg = "Yellow", modifiers = ["Bold"] }

that would look like this with my terminal colors:

Screenshot_20230203_203849


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/aome510/spotify-player/pull/118 **Author:** [@daschw](https://github.com/daschw) **Created:** 2/3/2023 **Status:** ✅ Merged **Merged:** 2/3/2023 **Merged by:** [@aome510](https://github.com/aome510) **Base:** `master` ← **Head:** `theme` --- ### 📝 Commits (6) - [`daf93ef`](https://github.com/aome510/spotify-player/commit/daf93efeb03205661ed3df6a3a52ab5de71ed415) Allow specifying only some of the component styles in theme.toml - [`bb9d1e7`](https://github.com/aome510/spotify-player/commit/bb9d1e7bec5a5ac46a02d84547e3219d0d42b7f5) Don't require palette in theme config - [`2c72820`](https://github.com/aome510/spotify-player/commit/2c72820eb4eca3543f156fa0db326ab200e71c5a) Implement border component style - [`7f31fd5`](https://github.com/aome510/spotify-player/commit/7f31fd59d38438e2e1d842bca9fe3bd0b49000b3) Implement selection component style - [`591568d`](https://github.com/aome510/spotify-player/commit/591568db595cbe27b517b96e07f6837008b97272) Implement review suggestions - [`54f8541`](https://github.com/aome510/spotify-player/commit/54f854112652ad8d9ab1cd53f155257dd0682ed4) update example theme config file and `theme_parse` script ### 📊 Changes **8 files changed** (+157 additions, -90 deletions) <details> <summary>View changed files</summary> 📝 `docs/config.md` (+7 -3) 📝 `examples/theme.toml` (+10 -0) 📝 `scripts/theme_parse` (+2 -0) 📝 `spotify_player/src/config/theme.rs` (+119 -78) 📝 `spotify_player/src/ui/page.rs` (+6 -3) 📝 `spotify_player/src/ui/playback.rs` (+2 -1) 📝 `spotify_player/src/ui/popup.rs` (+7 -3) 📝 `spotify_player/src/ui/utils.rs` (+4 -2) </details> ### 📄 Description Hi, thanks for this awesome piece of software! I just recently came across this project and played around with the theme config a little. At some point I thought it would be nice to have darker borders. However, I could not find this option anywhere in the component styles. So I thought I'd try to implement this myself. After I had finished, I realized that this would require every user to update their theme.toml files because without the new `border` option spotify_player would not be able to parse them and error. Furthermore I saw that you recently refactored the theming config and deleted `fg_selected` and `bg_selected` (or how they were called) and I saw the TODO comment to find a solution to not having to set each component style when adding this section in theme.toml. Hence I thought, before I add an option to change the border I'll try to figure out a way to solve this TODO. Afterwards, adding new component styles would not be an issue, because it would not affect older configs, that did not set this attribute. So that is what I ended up doing. With this PR - it is possible to only set some of the component styles in theme.toml - it is possible to not set the palette in theme.toml (and just modify component styles) - it is possible to set the border style with the new component_style attribute `border` - it is possible to set the style of the current selection with the new component_style `selection` I am quite sure that none of these changes affect any existing theme configs. With this I could now have a theme.toml like this ```toml [[themes]] name = "mine" [themes.component_style] border = { fg = "BrightBlack" } selection = { fg = "Yellow", modifiers = ["Bold"] } ``` that would look like this with my terminal colors: ![Screenshot_20230203_203849](https://user-images.githubusercontent.com/16589944/216692764-dde16014-1658-425a-8eb7-36dbaf27846f.png) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 23:49:08 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-player#634
No description provided.