Skip to content

unsafe_allow_html not behaving as expected to set text color #247

@treuille

Description

@treuille

Summary

In response to this issue, I was trying to get colored text to work using unsafe_allow_html, but it wasn't working as expected.

Steps to reproduce

Run this code:

import streamlit as st

colors = ['red', 'orange', 'yellow', 'green', 'blue', 'purple']
for color in colors:
    st.write('<span style="color:%s">%s</span>' % (color, color), unsafe_allow_html=True)

Behavior

Actual behavior

I don't see colors.

image

Expected behavior

I would've liked to see a nicely colored list of color names.

Debug info

$ streamlit version && python --version && pyenv --version && sw_vers && "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --version
Streamlit, version 0.47.2
Python 3.6.3
pyenv 1.2.3
ProductName:    Mac OS X
ProductVersion: 10.14.6
BuildVersion:   18G95
Google Chrome 77.0.3865.90 

Metadata

Metadata

Assignees

Labels

type:bugSomething isn't working as expected

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions