Articles

Get Material Design Color Hex Values Child Task

Material Design Color Hex Value

In the past, I’ve spent way too much time researching the precise Material Design color hex values.  Consequently, my Tasker tasks took longer than normal to complete.  I would locate the value, and copy-paste it into Tasker.  This process was too daunting to repeat over and over.  I knew something had to change if I was to continue using the specified colors.  In conclusion, I developed a 2-fold solution.  First I would obtain and store the data.  The second was to be able to call on the data every time I needed it.  My solution resulted in creating a child task called “Get Material Design Color Hex Values JSON”.   I use it just as much as I use my “Get Geofence” child task.

 

AutoTools JSON Actions




AutoTools and its JSON Write action was the first step in my solution.  With it, I assembled the color names and associated hex values into a well-structured JSON Object.  I saved the JSON Object to a Tasker global variable named “Material_Design_Color_Palette”.  Because of that, I now had global access to all specified Material Design Color hex values within Tasker.  As a result, my first problem of obtaining the data was solved.  My solutions’s second step was to call on that data.  In addition to the JSON Write action, JSON Read can parse a JSON Objects’s data.  As a result, it conveniently place it into custom variables or arrays.  Because it so so powerful, AutoTools JSON Read only requires a JSON Field parameter.  Furthermore, one can filter the results by Field and/or Value to fine-tune the information in the JSON object data structure.  And now the problem is solved!

Get Material Design Color Hex Values Child Task

Using the global variable, I created a child task and titled it “Get Material Design Color Hex Values”.  The child task requires the color name and also number value as parameters and results in the appropriate color hex value.  See the video example below.  Finally I coded for error handling and added comments before finalizing the Tasker task.  I can call the task using the “Perform Task” Tasker action without fail! With this child task, I’m no longer duplicating code nor wasting time on the internet.

Content Activity Example

The video below is a perfect example of how I execute the child task in Tasker.  While watching, take note of the Parameter and Return Value Variable fields in every Perform Task action.  Also note above mentioned return variables’ location within the Content Activity action fields.  I used Nick Mowen’s Material Design Tasker Plugin Content Activity.

Notes



What did you think???