St.error appear to be faded

Hello

I am trying to update the connectivity status on my streamlit web page. But I come across this issue when I try to update to the error element the element will appear to be faded.

status = st.empty()

if connected():
    status.empty()
    status.error(“connected to server”)
else:
    status.empty()
    status.error(“not connected to server”)

Am I doing it correctly?

FWIW your code works fine for me.

1 Like

Hi @qt.qt,

  1. I assume your function connected(), which is not reproduced here, returns either True / False, otherwise you will get an error
  2. You do not need the statements: status.empty()
  3. A suggestion: Change the ‘status.error’ part of the statement to ‘status.success’ for the ‘connected section’

Cheers