Skip to content

Optional colour themes (Dark, Creme, editable theme files) - #1077

Merged
SirSparkles merged 3 commits into
TV-Rename:masterfrom
kadeschs:themes-addin
Nov 14, 2026
Merged

SirSparkles merged 3 commits into
TV-Rename:masterfrom
kadeschs:themes-addin

Conversation

@kadeschs

@kadeschs kadeschs commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Hi Mark,

This is my take on #1029 (dark mode). It adds a Theme setting to Preferences > Display: Light (default), Dark, Creme, any custom theme file, and Same as Windows. The chosen theme is used the next time TV Rename starts. Light is the default and looks exactly as it does today; I compared screenshots pixel by pixel against a stock build of master and, apart from the new Theme box in Preferences, there is no difference.

Updated after your review: it's no longer a self-contained add-in, it's part of the main code (see my comment for how each of your points was done).

Theme files
Themes live in <settings folder>\Themes\*.theme.xml and show up in the Theme box automatically. Each file names its colours (27 of them, each with a comment saying what it is for) and is built on either Windows' dark look (base="Dark") or the standard light look (base="Light"). Anyone can copy a theme, change the colours and restart. The built-in themes are always kept untouched in Themes\Defaults, and the last copy of each theme that loaded correctly is kept in Themes\Backups. A bad colour falls back to its default and a broken file falls back to its backup. The user gets one message at startup explaining what went wrong (not with /hide or /unattended), and it is logged.

How it fits in

  • The choice is the Theme setting in TVRenameSettings.xml (TVSettings). ApplicationBase loads the theme straight after the settings and, for a dark theme, switches the colour mode before the main window is created.
  • Each form calls this.UpdateColorControls(); straight after InitializeComponent(). UpdateColorControls (UiHelpers) themes the form and everything on it, using the helpers in ThemeHelper.
  • TabControlThemed and ProgressBarThemed paint the tab strips and progress bars; ListViewColourer does the row colours and group titles of the lists.
  • ShowHtmlHelper adds the theme's styles to the Information, Images and Summary pages. Only TV Rename's own pages are styled, never real web sites, and exported HTML is unchanged.
  • Theme and ThemeManager (Settings folder) read the theme files.

For dark themes it fixes what Windows' dark mode leaves light or unreadable: tab strips, list headers, grid lines and group titles, the calendar, progress bars, disabled labels, the SourceGrid grids, black icons, list icons drawn on white, and colours set for the light look (warning, schedule, filter buttons). Light-based themes (Creme) only apply their colours.

What I tested (on a5c0998)
All main tabs, menus, all 18 Preferences tabs, Edit Show and the other dialogs, the splash screen, scan progress, the web pages and the Schedule colours, in Light, Dark, Creme and a custom theme of my own. I also switched themes through Preferences, tried mistyped and broken theme files, and started with /hide. Debug and Release builds add no new warnings.

Limits
Windows message boxes stay light. Creme uses the colours of the Magnetar browser extension's glass toolbar (github.com/ArrCee76/magnetar); Windows Forms can't draw its see-through glass, blur or gradients, so it's the colours only.

Screenshots

Light (default, unchanged):
Light (default)

Dark:
Dark

Creme:
Creme

Dark, Schedule:
Dark Schedule

Dark and Creme, Summary page:
Dark Summary
Creme Summary

The Theme setting in Preferences > Display (Dark and Creme):
Dark Preferences
Creme Preferences

The message shown for a theme file with mistakes:
Theme file message

Adds a Theme setting (Preferences > Display) with Light (default), Dark, Cream, any custom
theme file and Same as Windows. Themes are editable .theme.xml files in the settings folder
(Themes\), with pristine built-in copies in Themes\Defaults and the last good copy of each
theme in Themes\Backups. All code is in TVRename/AddIns/Themes; existing code gains two
hook lines (Program.Main and the splash constructor). The default Light look is unchanged.
@kadeschs

kadeschs commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

Rebased onto 5.2.6. The splash screen warning I mentioned is gone with your 5.2.6 changes, so I took that note out of the description.

@SirSparkles

Copy link
Copy Markdown
Collaborator

Hey,

Great work! Thank you so much for working on this - there is so much complexity to these overwrites. It's a really clever, tircky implementation. If we are to merge it in, then let's align it into the main code properly.

I'd propose:

  1. ThemeChooser is merged in with the Main Preferences.cs form, so we don't need to inject the controls at the end.
  2. Saving is done into Layout.xml or Settings.XML instead of another new file
  3. We can remove the idle sweep if we explicitly call OnFormShowing in the main codebase ? May improve performance?
  4. Merge ThemeStyler.ThemeControl with UiHelpers.UpdateColorControls
  5. Do away with WebPageStyler and send the Theme into ShowHtmlHelper.cs

In addition I'll:

  1. Update the Schedule/Scan icons to have a transpartent backcolour
  2. 2x YTS seems to have broken, so I'll see whether that's related
  3. See if there is a way of decorating a MessageBox - if not then use a custom one we can decorate

Thanks so much!

@SirSparkles

Copy link
Copy Markdown
Collaborator

We could also put some of the control overloads into a superclass for each Control. Similar to the way that ObjectListViewFlickerFree controls some of the specifics we want to customise.

@SirSparkles

Copy link
Copy Markdown
Collaborator

Some additional optimisations to combine:

  • OpenThemesFolder can merge with FileOperationExtensions
  • SaveChoice can merge with TVSettings.GenerateXElement and Load

Adds a Theme setting to Preferences > Display: Light (default), Dark, Creme,
any theme file in the Themes folder, and Same as Windows. The choice is saved
in TVRenameSettings.xml and used from the next start.
@kadeschs kadeschs changed the title Optional colour themes (Dark, Cream, editable theme files) as a self-contained add-in Optional colour themes (Dark, Creme, editable theme files) Nov 13, 2026
@kadeschs

kadeschs commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator Author

Thanks Mark, that all makes sense. I've reworked it along those lines and force-pushed. It's now one commit on top of a5c0998.

  1. ThemeChooser into Preferences.cs: the Theme box and Folder link are now ordinary designer controls on the Display page filled in with the other settings in Preferences_Load and saved in UpdateSettings.

  2. Saving: the choice is a Theme setting in TVRenameSettings.xml (TVSettings), so ThemeSettings.xml is gone. Because the settings load after Program.Main sets the colour mode, ApplicationBase now loads the theme straight after LoadSettingsAsync and switches to dark mode there before the main window is created. The splash screen is already up by then so it keeps the standard look.

  3. Idle sweep: the window hook and the idle sweep are both gone. Each form calls this.UpdateColorControls(); straight after InitializeComponent() (the same spot UI already calls ApplyColorOverrides), and ShowSummary and ActorsGrid call grid1.UpdateColorCells() after they fill their grids.

  4. ThemeStyler.ThemeControl: merged into UiHelpers.UpdateColorControls. The old ChangeTheme/SetColourScheme in UI were its only callers so I took them out. The helpers it uses are in ThemeHelper.

  5. WebPageStyler: gone. ShowHtmlHelper.HTMLHeader takes the theme and adds the styles to the page itself and CreateOldPage does the same for the simple pages. The exporters don't pass a theme so exported HTML is unchanged.

  6. Superclasses: TabControl and ProgressBar now have their own, TabControlThemed and ProgressBarThemed used in the designers the same way as ObjectListViewFlickerFree. That also got rid of the reflection call for OnDrawItem. The splash screen keeps a plain ProgressBar. I left the lists on a small NativeWindow ListViewColourer because they are spread over ListView, ListViewFlickerFree, ObjectListView, and ObjectListViewFlickerFree and moving them all to one class would change double buffering on some of them.

  7. OpenThemesFolder: gone. The Folder link just calls OpenFolder() from FileOperationExtensions.

  8. SaveChoice: gone. Covered by 2.

I also renamed Cream to Creme.

Testing: in Light, screenshots of the main tabs, menus, all the Preferences tabs, Edit Show and the other dialogs match a stock build of a5c0998 apart from the new Theme box and things that also change between two runs of stock where the focus rectangle lands live data. Dark and Creme match the previous version of this PR everywhere I checked separate from your own changes since 5.2.6 and a few small display fixes. This version also fixes something I'd missed before. With Light or Cream, the hook version laid out a few of the Preferences pages slightly differently from stock. The splash screen looks the same as stock in Dark and Creme. I also re-ran the broken theme file cases switching themes through Preferences and starting with /hide. Debug and Release builds add no new warnings.

On the two YTS windows, I opened both on a stock build of a5c0998 and on this branch in Light, Dark and Creme and they behave the same on both. In my setup, the Preview loads page after page but showed no movies within about 30 seconds and Recommendations comes up empty. So I don't think what you saw comes from this change.

Thanks for taking on the message boxes. On the Schedule/Scan icons, I know you said you’d do those. While testing I ran into the white boxes on the dark themes so I added a small workaround in ThemeHelper.ThemedIcons that clears the white background of a list’s icons and lightens their black lines on dark themes when a theme is in use. It only runs on icon lists without transparency so if you move them to a 32-bit list with transparent images it steps aside but then the dark themes would still need the black lines lightened (the magnifying glass handle is hard to see otherwise). Happy to take it out if you’d rather handle it your way.

@kadeschs

Copy link
Copy Markdown
Collaborator Author

Hi Mark, heads up on your push this morning. It looks like your local copy of themes-addin was from before my force-push, so the pull merged the old self-contained add-in commit (be91f56) back in alongside the rework (2b9c39e).

Compared to 2b9c39e, the branch now has:

  • the whole TVRename/AddIns/Themes/ folder back (13 files, about 3,100 lines)
  • ThemeManager.Startup(args) in Program.cs
  • ThemeManager.KeepStandardLook(this) in TVRenameSplash.cs

The old code is in the TVRename.AddIns.Themes namespace, so it may still compile, but both theme systems would run at startup.

The cleanest fix is to reset the branch to 2b9c39e. I'm happy to force-push that if it works for you. Afterwards, git fetch and git reset --hard <remote>/themes-addin on your side will get you back in sync. Or if you'd rather clean it up on your end, that's fine too.

@SirSparkles
SirSparkles merged commit 255fa93 into TV-Rename:master Nov 14, 2026
0 of 2 checks passed
SirSparkles pushed a commit that referenced this pull request Nov 15, 2026
PR #1077 was redone with themes built into the main code (Settings\Theme.cs, Settings\ThemeManager.cs, ThemeHelper). The first, self-contained add-in version (TVRename\AddIns\Themes and its hooks in Program and the splash screen) was carried in by a merge and ran alongside it.
@SirSparkles

Copy link
Copy Markdown
Collaborator

Yeah - I made a right mess of the commits and merges! It's been a while since anyone contributed...

I think I have it sorted now though??

@kadeschs

Copy link
Copy Markdown
Collaborator Author

No worries Mark, the merge itself looks good. The old add-in is gone, there's just the one theme system now, and your build fix and mine both came through cleanly.

One catch: master doesn't build as of the latest "Compiler Suggestions" commit. ThemeableMessageBox.cs stops with SYSLIB1050 and SYSLIB1062 on the DwmSetWindowAttribute line. It looks like the suggestion to switch DllImport to LibraryImport only got partly applied. Putting it back to DllImport like the rest of the code builds clean for me in Debug and Release, but your call on which way you'd rather go.

I also noticed the default theme is now Same as Windows. Was that on purpose? If so, the dropdown still says "Light (default)", and anyone on dark Windows who hasn't picked a theme will start in Dark after updating.

Nice touch on the themeable message box.

@kadeschs
kadeschs deleted the themes-addin branch November 15, 2026 17:55
@SirSparkles

Copy link
Copy Markdown
Collaborator

Yeah - sorry - my bad (again!). to be fair I have no idea of the pros/cons of dllimport vs libraryimport

For me (at least) the new themes are a little slow, so was trying to see what I could do to improve the performance. There are probably a few other async optimisations we can make.

Yes, I think 'WINDOWS' should be the default. I has thought it was just the 2 places I need to update, but if there are others then let me know.

@kadeschs

Copy link
Copy Markdown
Collaborator Author

No worries Mark, thanks for sorting the build.

DllImport vs LibraryImport: no practical difference for TV Rename. LibraryImport generates the interop code at compile time which mainly helps trimming/AOT. It's not a straight swap, though. It needs static partial methods in a partial class plus <AllowUnsafeBlocks>true</AllowUnsafeBlocks> which is why the suggestion broke the build. DllImport is fine to keep.

On Windows as default, the two TVSettings.cs lines (302, 1363) do the work. Two other spots to update:

  • ThemeManager.cs line 106 still shows "Light (default)". Move "(default)" to "Same as Windows" on line 110.
  • Preferences.cs line 925 falls back to Items[0] (Light) if the saved theme isn't found. It should probably fall back to Same as Windows.

Just a heads up, the existing settings files have no Theme entry so anyone in Windows dark mode will open in Dark after upgrading. Might be worth a line in the release notes.

On speed, where do you notice it most, startup, opening dialogs, or list refreshes? I can try to time Light vs Dark here to see where the time goes.

@SirSparkles

SirSparkles commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Thanks.

Have tried to fix with just one update in the ThemeManger

Yep - I will mention in the release notes

The speed comment refers to general UI snappiness - navigating and clicking around rather than any of the more major time-bound operations

@kadeschs

Copy link
Copy Markdown
Collaborator Author

Thanks Mark. Found it, it was my tab and progress bar painting. The fix is in #1084.

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