(Python) Plotly Scatter - Specify Line Color with Integer

Cross-posting from Stack Overflow (https://stackoverflow.com/questions/58955557/python-plotly-scatter-specify-line-color-with-integer-value):

Plotly allows a user to specify a color of a marker scatter plot based on an integer value e.g.:

go.Scatter(x=x,
           y=y,
           mode='markers',
           marker=dict(color=i))

where i is an integer. However, if I want to specify the color of a line, neither of the following work:

go.Scatter(x=x,
           y=y,
           mode='lines',
           marker=dict(color=i))

go.Scatter(x=x,
           y=y,
           mode='lines',
           line=dict(color=i))

How do I specify the color of a Plotly Scatter line using an integer?