At My Fingertips

Rapid Playground

Documentation

SDG Color Wheel

The Sustainable Development Goals were adopted by the United Nations in 2015. There are 17 goals. The SDG color wheel represents the 17 goals in a circular graphic with 17 segments.

Data Structure

Let's start by capturing the 17 goals. We will model each goal as an object consisting of three parts:

  • number -- goals are numbered from 1 to 17
  • color -- each goal has a separate color
  • title -- goals have short titles

We create a Python dataclass to model a goal this way.

Loading...

Now we will create 17 Goal objects, one for each SDG, and put them in a list named goals. Then we print the title of goal number 4.

Loading...

Visualization

Goal Color

Before creating the wheel, let's compose a "goal bar", a rectangle colored in the goal's color, overlaid with the goal's number in large white text and the goal's title in smaller white text.

Loading...

Decompose the Color Wheel

Now that we have our goals, we can compose our color wheel:

sdg-color-wheel.png

One way to decompose the SDG color wheel is to overlay a small white circle on top of a composition of 17 differently colored circular sectors. Each circular sector is 360 / 17 degrees wide (there are 17 SDGs). To separate the circular sectors, we overlay the composition with a composition of 17 white spokes, where each spoke a rectangle going from the center to the outer periphery of the wheel.

Implement the Color Wheel

Create functions to compose the various parts of the color wheel. Iterate over the 17 goals to create the 17 circular sectors, and also iterate to create the 17 white spokes.

Loading...

What You Learned

You practiced using a dataclass, using a list, and composing a regular rotational graphic.

You also learned about the Sustainable Development Goals. While we did not use the titles in this activity, you may want to read the titles to understand what the SDGs actually are about. And you may want to learn more about each goal on the official SDG website.


This activity has been created by LuCE Research Lab and is licensed under CC BY-SA 4.0.

SDG Color Wheel

Logo of PyTamaro

PyTamaro is a project created by the Lugano Computing Education Research Lab at the Software Institute of USI

Privacy PolicyPlatform Version 320e1c5 (Thu, 16 May 2024 14:11:39 GMT)