Colourise text in an input field

I want to change the colour of the text in an input field conditionally.

I create my input field as follows:

date = st.text_input(label="Published Date:", key="dateInput", value=st.session_state["current_date"])

My condition is like this:

        if response['date_adjusted'] == 1:
            st.session_state.dateInput = f":orange[{response['date']}]"
        else:
            st.session_state.dateInput = f":#FAFAFA[{response['date']}]"

However this does not colourise the text in the input field and just displays it as “:orange[{response[‘date’]}]”

How do I achieve what I want?

Best Regards,
Configentia

Hi @Configentia,

Thanks for posting!

Can you please add more code snippets or share the repo link so we can help troubleshoot?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.