Skip to content

Instantly share code, notes, and snippets.

@danielvlopes
Last active March 8, 2017 02:08
Show Gist options
  • Save danielvlopes/2f4ba8434a87fb4b6a0882e995264b56 to your computer and use it in GitHub Desktop.
Save danielvlopes/2f4ba8434a87fb4b6a0882e995264b56 to your computer and use it in GitHub Desktop.
Applet Cookbook: Adjust your lights as it gets darker outside
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