Watchmaker Wiki

The ultimate watch maker for Android Wear!

User Tools

Site Tools


tips:tapcolor

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
tips:tapcolor [2015/04/24 07:11]
jt3 [Color Field of Object]
tips:tapcolor [2015/04/24 07:16] (current)
jt3 [Explanation]
Line 28: Line 28:
 We start in the main script by initializing our variables. ​ we do this to avoid having a variable set to NULL, which is always a good idea.  The two variables we care about are "​var_clrnum,"​ which is color selection, and "​var_color1"​ which is the color itself. ​ If you were wanting to have themes, where each theme has multiple colors that go together, you'd simply add a var_color2, var_color3, etc. in the same manner. ​ Everything else would stay the same, and you'd use the same, single, var_clrnum, to set the color on everything. We start in the main script by initializing our variables. ​ we do this to avoid having a variable set to NULL, which is always a good idea.  The two variables we care about are "​var_clrnum,"​ which is color selection, and "​var_color1"​ which is the color itself. ​ If you were wanting to have themes, where each theme has multiple colors that go together, you'd simply add a var_color2, var_color3, etc. in the same manner. ​ Everything else would stay the same, and you'd use the same, single, var_clrnum, to set the color on everything.
  
-Let's take a closer look at that "​var_color1." ​ This is called an array (or table). ​ What we've done here is set 7 separate values to the same variable, each being a color in hexadecimal format. ​ These seven values are comma-separated,​ and since they'​re strings, each must have a string identifier. ​ In this case, we used apostrophes as string identifiers,​ but you can use quotes if you're one of **those** people :-P.  Just be consistent throughout each array. ​ Don't mix quote identifiers,​ or things can get ugly.+Let's take a closer look at that "​var_color1." ​ This is called an array (or table). ​ What we've done here is set 7 separate values to the same variable, each being a color in hexadecimal format. ​ These seven values are comma-separated,​ and since they'​re strings, each must have a string identifier. ​ In this case, we used apostrophes as string identifiers,​ but you can use quotes if you're one of **those** people :-P.  Just be consistent throughout each array. ​ Don't mix string ​identifiers,​ or things can get ugly.
  
 Since, in an array, a variable can have multiple values, we determine which value we want like this:  var_color1[1],​ var_color1[2],​ and so on.  So, all we need to do to change the color is change the number in the brackets. ​ That's where var_clrnum comes in. Since, in an array, a variable can have multiple values, we determine which value we want like this:  var_color1[1],​ var_color1[2],​ and so on.  So, all we need to do to change the color is change the number in the brackets. ​ That's where var_clrnum comes in.
tips/tapcolor.txt ยท Last modified: 2015/04/24 07:16 by jt3