Skip to content

Conversation

@bcorey
Copy link
Contributor

@bcorey bcorey commented Oct 20, 2025

This PR introduces the ability to choose and configure your blog theme from the TUI. Closes #31 .

RATATUI UPDATE
Ratatui has been updated from 0.24 to 0.29. While this made adapting the ratatui examples on the Table widget much easier, it did also require updating some table-related method calls across the project.

DETERMINISTIC THEME LIST
Previously we stored themes in a HashMap. This produced a nondeterministic page order that changed every time the theme table was viewed in the TUI. The map has been replaced with a Vec.

EDIT THEME FROM TUI
Choosing the theme from the TUI requires a new edit mode that displays a table of themes.

EDIT THEME CONFIG FROM TUI
ConfigField contains representations of each standard config field. A new variant needed to be added that could contain toml values from the theme config (as read from blogr.toml). We create as many of this field variant as is necessary for any given theme.

THEME CONFIG OPTIONS ARE NOW TOML
in the ConfigOption used to configure themes we had a field for type and a field for default value. It didn't seem we actually referenced these default values anywhere - but now we want to update blogr.toml with these values as soon as a new theme is selected. It helps a lot to condense the type and default fields into one field named value of type toml::Value.

theme-change-demo.mov

ISSUES

  • We utilize the TUI theme foreground colors but not the background color. Depending on the user's terminal background color and the selected blog theme, they may not be able to view the TUI easily. For example, the Musashi theme on a black terminal background.
  • The theme list isn't filtered by project type. blocked by Fix: Theme Compatibility Validation for Blog and Personal Sites #29 , which adds this property to themes.
  • When a user selects a new theme the TUI doesn't inherit the style of that theme until the TUI has been restarted.
  • The Config app has gotten big and should now be refactored into multiple files. I didn't do that for this PR because it makes the diff unreadable, but will create a follow up PR to do so.

@bcorey
Copy link
Contributor Author

bcorey commented Oct 20, 2025

Sometimes the theme wasn't found when serving the app. This is because the theme name as specified in the theme info may not match what the app is looking for in get_theme where theme names are defined a second time. now we run a find operation on the list of all themes and compare lowercased names to the search term, also converted to lowercase.

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.

Swap themes & edit theme config from TUI

1 participant