usmanyousaf commited on
Commit
48e8fe9
·
verified ·
1 Parent(s): 19dfe84

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -11
app.py CHANGED
@@ -40,6 +40,22 @@ COLOR_PALETTES = {
40
  "Minimal": {"primary": "#000000", "secondary": "#E0E0E0", "text": "#212121", "background": "#FFFFFF"}
41
  }
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  def get_ai_response(prompt: str) -> str:
44
  """Get formatted content from Groq API."""
45
  headers = {"Authorization": f"Bearer {GROQ_API_KEY}"}
@@ -223,22 +239,36 @@ def main():
223
  height=100
224
  )
225
 
226
- # Design settings
227
- with st.expander("Design Options"):
228
- col1, col2 = st.columns(2)
229
 
230
- with col1:
231
- font = st.selectbox("Font", list(FONT_CHOICES.keys()), index=1)
232
- color_palette = st.selectbox("Color Scheme", list(COLOR_PALETTES.keys()))
 
 
 
 
 
 
 
233
 
234
- with col2:
235
- title_size = st.slider("Title Size", 12, 44, 32)
236
- heading_size = st.slider("Heading Size", 12, 36, 24)
237
- body_size = st.slider("Body Text Size", 8, 28, 18)
238
- set_background = st.checkbox("Apply Background", True)
 
 
 
 
 
 
239
 
240
  design_settings = {
241
  "font": FONT_CHOICES[font],
 
242
  "color_palette": color_palette,
243
  "title_size": title_size,
244
  "heading_size": heading_size,
 
40
  "Minimal": {"primary": "#000000", "secondary": "#E0E0E0", "text": "#212121", "background": "#FFFFFF"}
41
  }
42
 
43
+ def get_custom_colors():
44
+ """Get custom colors from user input"""
45
+ col1, col2, col3 = st.columns(3)
46
+ with col1:
47
+ primary = st.color_picker("Primary Color", "#2B579A")
48
+ with col2:
49
+ secondary = st.color_picker("Secondary Color", "#5B9BD5")
50
+ with col3:
51
+ text = st.color_picker("Text Color", "#000000")
52
+ return {
53
+ "primary": primary,
54
+ "secondary": secondary,
55
+ "text": text,
56
+ "background": "#FFFFFF" # Default background for custom
57
+ }
58
+
59
  def get_ai_response(prompt: str) -> str:
60
  """Get formatted content from Groq API."""
61
  headers = {"Authorization": f"Bearer {GROQ_API_KEY}"}
 
239
  height=100
240
  )
241
 
242
+ # Enhanced Design settings
243
+ with st.expander("🎨 Design Options", expanded=True):
244
+ tab1, tab2 = st.tabs(["Preset Themes", "Custom Colors"])
245
 
246
+ with tab1:
247
+ col1, col2 = st.columns(2)
248
+ with col1:
249
+ font = st.selectbox("Font", list(FONT_CHOICES.keys()), index=1)
250
+ color_palette = st.selectbox("Color Scheme", list(COLOR_PALETTES.keys()))
251
+ with col2:
252
+ title_size = st.slider("Title Size", 12, 44, 32)
253
+ heading_size = st.slider("Heading Size", 12, 36, 24)
254
+ body_size = st.slider("Body Text Size", 8, 28, 18)
255
+ set_background = st.checkbox("Apply Background", True)
256
 
257
+ with tab2:
258
+ st.write("Create your own color scheme:")
259
+ custom_colors = get_custom_colors()
260
+ use_custom = st.checkbox("Use Custom Colors")
261
+
262
+ # Prepare design settings
263
+ if use_custom:
264
+ colors = custom_colors
265
+ color_palette = "Custom"
266
+ else:
267
+ colors = COLOR_PALETTES[color_palette]
268
 
269
  design_settings = {
270
  "font": FONT_CHOICES[font],
271
+ "colors": colors,
272
  "color_palette": color_palette,
273
  "title_size": title_size,
274
  "heading_size": heading_size,