Watchmaker Wiki

The ultimate watch maker for Android Wear!

User Tools

Site Tools


tips:dynamiccolor

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
tips:dynamiccolor [2015/01/22 03:08] – [Gradually Transition Color As Battery Drains, From Green to Yellow to Red] rahul_pawatips:dynamiccolor [2015/01/22 03:12] – [Gradually Transition Color As Battery Drains, From Green to Yellow to Red] rahul_pawa
Line 67: Line 67:
 The result is that the color changes from bright green to bright yellow with each battery decrease. The result is that the color changes from bright green to bright yellow with each battery decrease.
  
-There is similar code in the second condition to transition from yellow to red when the battery level is between 16 and 66.+There is similar code in the second condition to transition from yellow to red when the battery level is between 16 and 66:
  
    {bl} > 16 and string.format('%s%x%s','FF',({bl}-16)*255/50,'00')    {bl} > 16 and string.format('%s%x%s','FF',({bl}-16)*255/50,'00')
  
-And finally, if the battery is below 16 the color will be bright red.+In the above you should note there are now four arguments in the string.format function. The three codes each correspond to arguments 2-4 in order. The formula has changed a little because I am using a bigger range, I've decided that I want the gradual transition from yellow to red to start at battery level = 66, and end at battery level = 16. 
 + 
 +And finally, if the battery is below 16 the color will be bright red:
  
    or 'FF0000'    or 'FF0000'
tips/dynamiccolor.txt · Last modified: 2016/07/05 19:32 by wmissimer