Fix: Themes preset editing and persistence and display of theme item values#232
Conversation
…hange config to track presets
|
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. |
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 Running Running |
|
@all-contributors add @Moaht for code |
|
I've put up a pull request to add @Moaht! 🎉 |
Adds @Moaht as a contributor for code. This was requested by LargeModGames [in this comment](#232 (comment)) [skip ci]
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 --allresulted in no noise.Running
cargo clippy --locked -- -D warningsresulted in:Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.36sRunning
cargo test --lockedresulted in:Resume this session with: │test result: ok. 165 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.11sAdditional notes