Nehal07 commited on
Commit
cb989c0
1 Parent(s): c2ca9a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -2,8 +2,8 @@ import streamlit as st
2
 
3
  # Function to change text color based on user input
4
  def change_text_color(text, color):
5
- # Apply HTML styling to change text color
6
- styled_text = f'<span style="color:{color}; font-size: 24px; font-weight: bold;">{text}</span>'
7
  return styled_text
8
 
9
  # Streamlit app
@@ -18,7 +18,7 @@ st.subheader("Select text color:")
18
  # Expanded list of predefined color options
19
  color_options = [
20
  "red", "blue", "green", "orange", "yellow", "purple", "pink", "brown", "gray",
21
- "cyan", "magenta", "violet", "indigo", "lime", "olive", "teal", "navy", "maroon",
22
  "aquamarine", "azure", "beige", "black", "fuchsia", "silver", "white",
23
  "lavender", "turquoise", "plum", "salmon", "sienna", "tomato", "wheat", "orchid",
24
  "thistle", "peru", "royalblue", "dodgerblue", "darkslategray", "darkseagreen",
@@ -45,6 +45,8 @@ if selected_color == "Custom":
45
  styled_text = change_text_color(user_text, selected_color)
46
  st.markdown(styled_text, unsafe_allow_html=True)
47
 
48
- # Add a separate submit button
49
- if st.button("Submit"):
50
- st.success("Text color changed successfully!")
 
 
 
2
 
3
  # Function to change text color based on user input
4
  def change_text_color(text, color):
5
+ # Apply HTML styling to change text color, set font size, and add a border
6
+ styled_text = f'<div style="color:{color}; font-size: 32px; font-weight: bold; border: 2px solid {color}; padding: 10px;">{text}</div>'
7
  return styled_text
8
 
9
  # Streamlit app
 
18
  # Expanded list of predefined color options
19
  color_options = [
20
  "red", "blue", "green", "orange", "yellow", "purple", "pink", "brown", "gray",
21
+ "cyan", "magenta", "violet", " indigo", "lime", "olive", "teal", "navy", "maroon",
22
  "aquamarine", "azure", "beige", "black", "fuchsia", "silver", "white",
23
  "lavender", "turquoise", "plum", "salmon", "sienna", "tomato", "wheat", "orchid",
24
  "thistle", "peru", "royalblue", "dodgerblue", "darkslategray", "darkseagreen",
 
45
  styled_text = change_text_color(user_text, selected_color)
46
  st.markdown(styled_text, unsafe_allow_html=True)
47
 
48
+ # Add a separate custom button
49
+ if st.button("Customize Text Color"):
50
+ selected_color = st.color_picker("Choose a custom color:")
51
+ styled_text = change_text_color(user_text, selected_color)
52
+ st.markdown(styled_text, unsafe_allow_html=True)