Tutorials

How To Create A Material Design Color Values Child Task

How To Create A Material Design Color Values Child Task

Creating a Tasker child task is always helpful.  Even more so in larger projects.  While child tasks allow for smaller overall code, they also allow for easier maintenance.  And because of this, parent tasks become easier to read and understand.  Follow the steps below to create a Material Design Color Values child task.  Then continue to create the associated parent task.

 

Objective




Create a child task, which returns the hexadecimal color code, resulting in a local variable, based on Google Material Design Color Values.

Required Apps

  • Tasker
  • AutoTools

Steps

Follow the steps below and soon you’ll be able to create beautifully colored Tasker projects!

Setup

  • Firstly, download the JSON file here and place it in the “AutoTools” folder.

Create The Task

  • Task Setup:
    • Action 1 – If:
      • Condition: “%Material_Design_Color_Hex_Values”
      • Operator: “!Set”
    • Action 2 – Flash:
      • Text: “Reading JSON file into variable…”
    • Action 3 – Read File:
      • File: “[PATH YOU PLACED FILE FROM ABOVE]”
      • To Var: “%Material_Design_Color_Hex_Values”
    • Action 4 – End If:
    • Action 5 – Variable Set:
      • Name: “%material_design_color_hex_values”
      • To: “%Material_Design_Color_Hex_Values”
    • Action 6 – AutoTools Json Read:
      • Simple Mode: [checked]
      • Json: “%material_design_color_hex_values”
      • Fields: “%par2”
      • Filter Fields: “color”
      • Filter Values: “%par1”
      • Exact: “True”
      • Variable Name: “color”
      • Separator: “,”
    • Action 7 – If:
      • Condition: “%color”
      • Operator: “!Set”
    • Action 8 – Flash:
      • Text: “Verify name and color parameters”
    • Action 9 – Else:
    • Action 10 – Return:
      • Value: “%color”
      • Stop: [checked]
    • Action 11 – End If:

Test Out Get Material Design Color Values

  • Create a new Task:
    • Title: “Test Get Material Design Color Hex Values”
  • Action 1 – Perform Task:
    • Name: “Get Material Design Color Hex Values”
    • Parameter 1: “Red”
    • Parameter 2: “500”
    • Return Value Variable: “%color”
  • Action 2 – Flash
    • Text: “%color”
  • Now try it again with other color names and values such as “Teal”, “Amber”, “Blue”, “200”, “A100”.  Hence the task flash: “#[HEX VALUE]”.
  • Then try it again with names and values other than what is listed by Google here.  Then the task should flash “Verify name and color parameters”.

Material Design Color Values Use Cases




Especially relevant is that this child task will return a Tasker local variable. It should have a hash mark (#) followed by the 6-digit hex color value.  Also, and as stated above, follow Google’s Material Design page to see all your options.  Finally, test and combine your theme colors to create beautiful tasks and projects.  Then add the child task call as many times as you would like to brighten your Tasker scenes and KLWP/KWGT themes/text/objects/icons.  Additionally, theme  AutoTools Toasts to match your project’s visual feedback. Similarly, test colorful AutoNotifications for anything your mind wants! Eventually you’ll create some very pretty Tasker Tasks and Projects.  In conclusion, check out my gorgeously-colored video using MD Plugin’s Content Activity and enjoy!

And because I don’t want you to suffer too much reading the entire post, download the XML project HERE

Related Articles

What did you think???