You can do this in many ways, and you can take a look at Plotly: How to define colors in a figure using plotly.graph_objects and plotly.express? for some details. But since you're specifically asking how to assign a color to a trace by the name of the source data in a pandas dataframe, I would use color_discrete_map = color_dict
, where color_dict
is a dictionary that contains {"Close":'#565454',"MA":"red"}
, like this:
fig = df.plot(x=df.index,y=["Close","MA"],template="simple_white",
color_discrete_map = color_dict)
Plot 1:

To include another trace, I would use fig.update_trace
along with the trace type of choice like this:
fig.add_trace(go.Scatter(x=df.index, y=df['Close']*2,
mode = 'lines',
line_color = 'blue'))
Plot 2:

Complete code:
import numpy as np
import pandas as pd
pd.options.plotting.backend = "plotly"
df = pd.DataFrame({"Close":[1,2,3,4,5,8,7,8],"MA":[2,2,2,3,4,4,6,7]})
color_dict = {"Close":'#565454',"MA":"red"}
fig = df.plot(x=df.index,y=["Close","MA"],template="simple_white",
color_discrete_map = color_dict)
fig.add_trace(go.Scatter(x=df.index, y=df['Close']*2,
mode = 'lines',
line_color = 'blue'))
fig.show()