Black and white colors are only seen when Plotly is downloaded as html file or a png or jpeg file

Hi everyone,

This is actually expected because we change the underlying colors to black and then replace them on the front end to colors that match our dark or light theme best.

In order to deal with this, you can use this something like this:

import plotly.io as pio
import streamlit as st
import plotly.express as px

pio.templates.default = "plotly"

df = px.data.tips()
fig = px.scatter(
    df,
    x="total_bill",
    y="tip",
    color="day",
    color_discrete_sequence=[
        "#0068c9",
        "#83c9ff",
        "#ff2b2b",
        "#ffabab",
        "#29b09d",
        "#7defa1",
        "#ff8700",
        "#ffd16a",
        "#6d3fc0",
        "#d5dae5",
    ],
    title="streamlit colors",
)
st.plotly_chart(fig)
3 Likes