Skip to main content
Completion requirements

3. Style Basins with Random Colors

Let's start with styling the basins. We're going to give the basins a random color.

1. In the Layers panel, drag the basins polygon layer to the top.

2. Activate (select) the layer and click to open the Layer Styling panel.

3. Change the renderer from Single Symbol to Graduated.

To get random colors, we're going to use an expression for Value.

4. At Value click to open the Expression Dialog.

5. Use the search box to search for the rand function and read what it does.

6. Double-click on rand to add it to the expression.

7. Complete the expression so it reads:

rand( 0,9999 )

This will create for each feature a random integer number between 0 and 9999.

8. Click OK to go back.

9. At Color ramp choose Random colors.

10. Change the amount of Classes to 150.

11. Click Classify to apply the settings.


Each time you click Classify it will update the random colors. So you can do this until you're satisfied with the color distribution.

Next, we'll focus on styling the rivers.