If you change to mode='lines+markers you will see, that the markers are colored depending on their value. The thing is, that you want to color the lines which can be done via line=dict(color=your_discrete_color)
You can specify only one color per line.
If you want to use the viridis colorscale for the line colors, you’ll hav to convert it to a discrete values, here an example: