First off, it's funny because when I saw your DEM, I knew exactly where it is instantly, that's my hometown.
There is a much simpler solution that I developed when I wasn't able to use the method you tried. No need to break the features into bits, no scripting or GRASS tools, just plain rendering tricks.
First off, you need to have a simple fill symbology on the layer. If your isolines are of type line, you'll need to polygonize them with a suitable processing tool. Two can give the right result:
- Lines to polygons will yield polygons with no voids which means a closed contour inscribed in another will overlap. This isn't problematic but it will require an additional rendering step to work.
- Polygonize will yield non-overlapping polygons. This will save a rendering step further along the way but the layer will be composed entirely of doughnut polygons, which might not be ideal for certain tasks.
When you have a polygon layer, choose graduated symbology type and set the gradient according to the contour elevation field. This works best if you want discrete color steps. Then,
- Go to your isoline layer properties, then to the symbology tab.
- Open the symbol selector dialog
- At the bottom, tick the draw effects checkbox
- Then click on the customize effects button
From there, you can play around. In the case of the project in my screenshot, I used two drop shadows, one white at -45° and one black at 135°. You can play around with the offset distance to achieve the boldness you want.
Optional: If your isoline layer contains overlapping polygons (for example resulting from the lines to polyons tool), there's one setting left to set for the whole thing to work correctly: in the main layer properties, go to the layer rendering section and tick the control feature rendering order checkbox, then open the corresponding dialog and set the controlling data field to whichever contains the elevation values, ordering it as ascending. That way, features will get rendered progressively from the bottom up. That's pretty much it!