How can I dynamically change trace colors (and corresponding legends) in an HTML file created with the .to_html() function?

I’ve created an app that allows users to upload an excel or .csv file, extract the data and generate a plot for their desired data. I’m using plotly to produce the figures. I’ve included an option to create an .html file (so the user can access it later) containing the plot by using plotly’s .to_html() function.

By default, this function creates an .html file containing plots with some level of interaction such as dynamic zoom, and capability to hide/unhide traces on the figure. This is great, but as I push this app out for others to use, I’d like them to also be able to change the colors of the traces on the figures, without requiring them to go into the source code. Ideally, the user would simply click on the plot/trace of interest on the legend (or some other button) then choose a new color.

Is it possible to add additional or custom interactive/dynamic functionality to the plots generated by plotly? Specifically, is there a way to allow users to change the color of plots on a figure that has already been written to an .html file?

For context, I am using the python version of plotly.