Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Night Mode icon

Night Mode

A blue-light filter for Windows, with an interface that doesn't look like Tkinter.

Warm your screen at night, on a schedule or a hotkey, across every monitor — from a frameless window with a real acrylic backdrop.

Night Mode filter page

What it does

Night Mode lays a configurable warm tint over your screen so you're not staring into blue light at 2am. It's a small, single-file Python app with no server, no telemetry and no account.

  • Colour temperature from 1200 K (candle) to 6500 K (daylight), with a live preview
  • Custom tints — six presets plus a full RGB picker
  • Per-monitor targeting — pick which screens get covered; hot-plug is detected
  • Schedule — on and off at set times, including windows that cross midnight
  • Global hotkey — toggle from anywhere, default Ctrl+Alt+N
  • Tray icon with quick presets, plus start-with-Windows
  • Presets — Reading, Movie, Late night, Focus
  • Everything persisted to %APPDATA%\NightMode\settings.json

Download

Grab NightMode.exe from the latest release. It's a single self-contained file — no Python needed. 64-bit Windows 10 (1803+) or 11.

Note

The exe isn't code-signed, so Windows SmartScreen will show "Windows protected your PC" on first run. Click More info → Run anyway. Some antivirus products also flag PyInstaller one-file builds as a false positive.

Or run from source:

pip install -r requirements.txt
python nightmode.py

How it works

The two filter engines

Overlay (default) creates one borderless, click-through window per selected display, tinted and alpha-blended over everything. Each overlay carries WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_NOACTIVATE | WS_EX_TOOLWINDOW, so it's invisible to the mouse, never takes focus, and stays out of Alt+Tab. Fades in and out on an eased curve.

Display gamma writes the graphics card's colour ramp with SetDeviceGammaRamp, shifting the whole desktop — including exclusive-fullscreen games, which no overlay can cover. Plenty of setups refuse gamma ramps outright (HDR, hybrid graphics, virtual displays), so support is probed at startup rather than assumed: if the driver won't even return the current ramp, the option is labelled unavailable and the app stays on the overlay engine instead of silently doing nothing.

The tint itself comes from a black-body approximation of the chosen Kelvin value, scaled so the warmest channel stays at full strength — the same shape of curve f.lux and Night Light use.

The interface

It's CustomTkinter, but pushed well past the defaults.

Real glass, not a gradient. The window is frameless, clipped to rounded corners with SetWindowRgn, and gets a live acrylic backdrop through the undocumented SetWindowCompositionAttribute, so the desktop genuinely blurs behind it. Two things make this fragile, and both are handled:

  • Tk's -alpha and -transparentcolor both go through SetLayeredWindowAttributes, which wipes the composition attribute. Opacity is always set first and the backdrop applied last — and re-applied after anything that touches window attributes, including topmost changes and restoring from the tray.
  • Acrylic makes window dragging stutter on Windows 10, so the app drops to plain blur while the window is being moved and restores acrylic on release.

Controls are drawn, not widgets. Tk's canvas has no antialiasing, so every switch, slider, segmented control and colour chip is rendered with Pillow at 3× supersampling and downsampled with Lanczos — including soft drop shadows via Gaussian blur, and gradient slider tracks. That's why the curves are clean. Everything scales with the monitor's DPI.

Schedule page Settings page

Right: gamma is shown as unavailable because that machine's driver refuses gamma ramps — exactly the fallback described above.

Settings

Filter engine Overlay (per-display) or display gamma (system-wide)
Appearance 8 accent colours, dark/light theme, acrylic / blur / solid glass, window opacity
Behaviour Start with Windows, start hidden in tray, close to tray, keep on top
Hotkey Ctrl+Alt+N, Ctrl+Shift+N, Alt+F10, Ctrl+Alt+B, Win+Alt+N, or off
Safety Maximum intensity cap, so the screen can never go fully dark
Motion Fade duration, 0–800 ms

Building

powershell -ExecutionPolicy Bypass -File build.ps1

Regenerates the icon and produces a single dist\NightMode.exe (~14 MB, no console window) via PyInstaller.

nightmode.py        the whole app
build.ps1           builds the exe
tools/make_icon.py  regenerates assets/icon.ico

Known limits

  • Windows only. The glass, click-through overlays, gamma ramps, hotkeys and tray all go through Win32. The app will start elsewhere but without any of that.
  • Light theme renders opaque by design. Dark text over a bright blurred desktop loses all contrast, so light mode ignores the glass setting.
  • The overlay can't cover exclusive-fullscreen games. Use the gamma engine where the driver allows it.

License

MIT — see LICENSE.

About

A blue-light filter for Windows with a frameless acrylic-glass interface, per-monitor overlays, scheduling and a global hotkey.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages