Skip to content

Fix: Themes preset editing and persistence and display of theme item values#232

Merged
LargeModGames merged 7 commits into
LargeModGames:mainfrom
Moaht:main
May 3, 2026
Merged

Fix: Themes preset editing and persistence and display of theme item values#232
LargeModGames merged 7 commits into
LargeModGames:mainfrom
Moaht:main

Conversation

@Moaht
Copy link
Copy Markdown
Contributor

@Moaht Moaht commented Apr 29, 2026

Summary

This pull request addresses the issues in #230 and #231.

It adds a new theme preset called Custom which gets activated whenever the RGB values are edited. This means that editing the RGB values of a theme item now has an effect. After editing a preset, the currently selected preset changes to Custom. The Custom setting becomes populated with the values of the edited preset along with the edits that make it customised. Whenever the user cycles through the presets, they can reload the preset and then come back to the Custom settings they changed earlier. This is saved using the existing values in the config.
Currently selected presets, not just the RGB values for the items, are now tracked in the config.
Cycling through the theme presets when pressing enter now shows the RGB values that correspond to the in focus preset.
Exiting the themes settings and re-entering, the active preset is seen right away which helps the user understand that it is in use.

Testing

Running cargo fmt --all resulted in no noise.

Running cargo clippy --locked -- -D warnings resulted in:
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.36s

Running cargo test --locked resulted in:
Resume this session with: │test result: ok. 165 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.11s

Additional notes

Screenshot From 2026-04-29 20-00-14

@LargeModGames
Copy link
Copy Markdown
Owner

Could you check if the old preset themes still work? Im not sure how backward compatibility for existing configs that have custom theme colors but no theme.preset yet work

@Moaht
Copy link
Copy Markdown
Contributor Author

Moaht commented Apr 29, 2026

Could you check if the old preset themes still work? Im not sure how backward compatibility for existing configs that have custom theme colors but no theme.preset yet work

Everything in the config should works the same as it did before except now it has a "preset" entry.

The other keys in the config are exactly the same and are used for the Custom preset.

Actually, just checking it through now: it loads the presets fine and the custom settings are saved in the session, but there seems to be an issue with the custom values being loaded after a reboot. I'll have to take a look and fix that.
When I'm done I'll try loading up custom settings in the config in the current version and then seeing if they are compatible with the changes, i.e they persist and work after the update (is that what you meant)?

@LargeModGames
Copy link
Copy Markdown
Owner

Actually, just checking it through now: it loads the presets fine and the custom settings are saved in the session, but there seems to be an issue with the custom values being loaded after a reboot. I'll have to take a look and fix that.
When I'm done I'll try loading up custom settings in the config in the current version and then seeing if they are compatible with the changes, i.e they persist and work after the update (is that what you meant)?

yes that is what i meant

@Moaht
Copy link
Copy Markdown
Contributor Author

Moaht commented Apr 29, 2026

Actually, just checking it through now: it loads the presets fine and the custom settings are saved in the session, but there seems to be an issue with the custom values being loaded after a reboot. I'll have to take a look and fix that.
When I'm done I'll try loading up custom settings in the config in the current version and then seeing if they are compatible with the changes, i.e they persist and work after the update (is that what you meant)?

yes that is what i meant

Okay. Then yes it all works exactly as it should.

A couple of things were holding things up:

I thought there was some issue with the loading of the background colours but it was just the "Reset" value which uses the set terminal colours. Obviously this can vary quite a bit tmux,screen,tty vim etc.

In b972a97 I've now added new options in the theme menu for users to change the other settings such as background colour etc if they wish. And you can still reset to terminal default using "Reset" at any time in the UI or in the config.

After upgrading to f04462e, configs would not have their past custom colours from their configs loaded immediately. They would have to go to Settings > Themes and select Custom and their custom colours from before would then be shown. I've now changed this in 64890de so that a simple check to see if the preset key doesn't exist and any of the colour values exist in the config, to use the custom config option. This now solves the issue of backwards compatibility.

Running cargo fmt --all resulted in no noise.

Running cargo clippy --locked -- -D warnings resulted in:

Finished `dev` profile [unoptimized + debuginfo] target(s) in 3.11s                                                                                                                                            

Running cargo test --locked resulted in:

Finished `test` profile [unoptimized + debuginfo] target(s) in 2.93s                    
Running unittests src/main.rs (target/debug/deps/spotatui-c425a8bb622d87c9)                                                                                                                                   
test result: ok. 165 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.10s

@LargeModGames LargeModGames merged commit d6135ac into LargeModGames:main May 3, 2026
5 checks passed
@LargeModGames
Copy link
Copy Markdown
Owner

@all-contributors add @Moaht for code

@allcontributors
Copy link
Copy Markdown
Contributor

@LargeModGames

I've put up a pull request to add @Moaht! 🎉

LargeModGames added a commit that referenced this pull request May 3, 2026
Adds @Moaht as a contributor for code.

This was requested by LargeModGames [in this
comment](#232 (comment))

[skip ci]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants