Using context instructions
This recipe brings colors to our apps. As we said, the context instructions are those that do not draw but give context to the canvas. The recipe will give color to some geometric shapes.
Getting ready
The last recipe is related to this recipe. So, it should be useful to compare them because you will better understand the difference between the context and drawing instructions with practice. Also, we will use different color models, such as RGB.
How to do it…
Here, we are going to use a simple Python file in our app and concentrate on the KV file, which will have context and drawing instructions to generate the graphics in the app. To complete the recipe, follow these steps:
In the KV file, define the rule for the root widget.
Define the canvas property for the root widget.
Add the drawing instructions for an ellipse.
Add the context instructions for a color in RGB.
Add the drawing instructions for a rectangle.
Add the drawing instructions for a triangle.
Add the context...