How to use multiple colours in title text

Hello,

I know how to set specific words to bold using HTML tags. Is there some way to set individual colours?

Thank you

You can add a style tag like so: style={“color”: “blue”}. Here is some documentation: Dash HTML Components | Dash for Python Documentation | Plotly

Thank you. I am setting subplot title text as:

fig['layout']['annotations'][i]["text"] = "blah"

That requires actual text… I am assuming I have to use this…?:

from dash import html

html.Div([
    html.Div('Example Div', style={'color': 'blue', 'fontSize': 14}),
    html.P('Example P', className='my-class', id='my-p-element')
], style={'marginBottom': 50, 'marginTop': 25})

Just need a bit more of a nudge :slight_smile:

Looks like you can do: fig.update_annotations(color= “blue”). Check out this thread for info: Setting Subplot Title Font Sizes

Thanks Kelly,

My use-case is a little different I want my text to be like : “Blue…Red…Green” in the same line

Ah! My apologies. Read too quickly the first time. I haven’t done this before. I’ll try some stuff though and see if I can figure it out!

Many thanks Kelly

You might find this post helpful: Multiple color in title text - #3 by atharvakatre

1 Like

Great! that works. Many thanks.

2 Likes