At My Fingertips

Documentation

Hue Bar

Description

Implement the hue_to_tile and the hue_bar functions to produce the following graphic.

hue bar

This is a hue bar consisting of 360 tiles, each tile is a rectangle, colored with a fully saturated (saturation 1.0) fully light (value 1.0) color in the corresponding hue (0 to 359). Use the pytamaro hsv_color function to create the color from the hue, saturation, and value.

The hue_to_tile function

This function should return a rectangle of the given width and height. The color of the tile is composed of the given hue, a saturation of 1, and a value of 1, using the pytamaro hsv_color function.

Assert that the value of the hue parameter is acceptable (between 0 and 360).

Loading...

The hue_bar function

This function takes the wanted tile_width and tile_height for each of the 365 tiles, and it produces 360 hue tiles corresponding to each hue value from 0 to 359. Ultimately it returns a Graphic with each tile placed beside the other.

To achieve this you can use a for-loop.

In each step of the loop you want to create a tile of a different hue, and place it beside the previous tiles.

Use the result variable to store the graphic containing all the (previous) tiles together.

Loading...

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

Hue Bar

Logo of PyTamaro

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

Privacy PolicyPlatform Version 0d7866a (Fri, 20 Dec 2024 07:46:38 GMT)