Hacker News new | ask | show | jobs
by gabrielsroka 236 days ago
Years ago, I wrote a very stripped-down version in a few lines of PowerShell. I'll upload it when I get home.
2 comments

I did the same just a few days ago based on webcam, 26 lines of PowerShell.

See https://gist.github.com/lostmsu/cde4a8578d8e0ea1182f579f44bd...

my minimal powershell code

    $old = -1
    while ($true) {
        $d = Get-Date
        $hour = $d.Hour
        if ($hour -ge 6 -and $hour -lt 19) {
            $light = 1
        } else {
            $light = 0
        }
        if ($old -ne $light) {
            Set-ItemProperty HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize AppsUseLightTheme $light
            $old = $light
            echo $light $d
        }
        sleep -Seconds 2
    }