Skip to content

Timthreetwelve/toggletheme

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ToggleTheme

License: MIT Go Version Platform GitHub release (latest by date) GitHub Release Date GitHub commits since latest release (by date) GitHub last commit

ToggleTheme is a lightweight Windows system tray app that switches your system theme between Light and Dark mode. Nothing fancy, just switches themes.

It runs in the notification area, lets you toggle themes with a click, and keeps its menu label in sync when theme settings change externally.

I wrote it to quickly switch between themes while working on a new theme for my .NET apps. Maybe you could find a use for it too.

Features

  • Runs as a tray app (no main window)
  • Left-click tray icon to toggle Light/Dark mode
  • Right-click menu with:
    • Switch to Dark Mode / Switch to Light Mode
    • About
    • Quit
  • Watches Windows theme registry keys and updates menu text automatically
  • Writes logs to %TEMP%\\toggletheme.log

How It Works

ToggleTheme updates these Windows registry values under:

HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize

  • AppsUseLightTheme
  • SystemUsesLightTheme

When either value changes, the app refreshes the tray menu label to reflect the current mode.

Requirements

  • Windows
  • Go 1.26.4 (from go.mod)

Build

From the project root:

go mod tidy
go build -ldflags "-s -w -H=windowsgui" -trimpath -o toggletheme.exe

Run

./toggletheme.exe

After launch, look for the tray icon in the Windows notification area.

Regenerate Windows Resources

If you update winres/winres.json, regenerate resources with:

go-winres make

Project Structure

.
|- main.go
|- dark-theme.ico
|- go.mod
|- go.sum
|- go.work
|- winres/
|  |- winres.json
|- rsrc_windows_386.syso
|- rsrc_windows_amd64.syso

Troubleshooting

  • No tray icon appears: Ensure the app is running and check hidden icons in the taskbar overflow area.
  • Theme does not switch: Verify your Windows personalization settings are not restricted by policy.
  • Need diagnostics: Open %TEMP%\\toggletheme.log for startup and runtime logs.

License

This project is licensed under the MIT License. See LICENSE.

About

Simply toggles Windows theme

Resources

License

Stars

Watchers

Forks

Contributors

Languages