Spaces:
Runtime error
Runtime error
import streamlit as st | |
# Function to change text color based on user input | |
def change_text_color(text, color): | |
# Apply HTML styling to change text color | |
styled_text = f'<span style="color:{color};">{text}</span>' | |
return styled_text | |
# Streamlit app | |
st.title("Text Color Changer") | |
# Input text and color selection | |
user_text = st.text_input("Enter your text:") | |
selected_color = st.selectbox("Select text color:", ["red", "blue", "green", "orange"]) | |
# Apply text color change and display | |
styled_text = change_text_color(user_text, selected_color) | |
st.markdown(styled_text, unsafe_allow_html=True) | |