Last active
March 8, 2017 02:08
-
-
Save danielvlopes/2f4ba8434a87fb4b6a0882e995264b56 to your computer and use it in GitHub Desktop.
Applet Cookbook: Adjust your lights as it gets darker outside
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hour = Meta.currentTime.hour() | |
var colorKey = hour.toString() | |
var colors: {[key:string]:string} = { | |
"17":"#F3F2EB", | |
"18":"#F7F2E6", | |
"19":"#F9EFE0", | |
"20":"#FBEFDC", | |
"21":"#FBE5C6", | |
"22":"#FBE5C6" | |
} | |
if (hour < 17) { | |
Lifx.color.skip("Too early") | |
} else if (hour < 22) { | |
Lifx.color.setAdvancedOptions( | |
'color: ' + colors[colorKey] + '; brightness: 1; duration: 12' | |
) | |
} else { | |
Lifx.color.skip("Too late") | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment