vsj0702 commited on
Commit
99f1fce
·
verified ·
1 Parent(s): 1a353ec

fixing bugs

Browse files
Files changed (1) hide show
  1. layout.py +71 -10
layout.py CHANGED
@@ -1,43 +1,104 @@
1
- import streamlit as st
2
-
3
- def init_session_state():
4
- st.session_state.setdefault("code", "")
5
- st.session_state.setdefault("stdin", "")
6
- st.session_state.setdefault("theme", "light")
7
-
8
  def apply_theme(theme):
 
 
9
  LIGHT = {
10
  "bg": "#f5f5f5",
11
  "panel": "#ffffff",
12
  "text": "#1a1a1a",
13
- "border": "#dddddd"
 
 
 
14
  }
15
  DARK = {
16
  "bg": "#0f1620",
17
  "panel": "#1c2330",
18
  "text": "#e3e8f1",
19
- "border": "#2a3240"
 
 
 
20
  }
21
 
22
  colors = DARK if theme == "dark" else LIGHT
23
 
24
  st.markdown(f"""
25
  <style>
 
26
  .stApp {{
27
  background-color: {colors["bg"]};
28
  color: {colors["text"]};
29
  }}
 
 
30
  [data-testid="stSidebar"] {{
31
  background-color: {colors["panel"]} !important;
32
  }}
33
- textarea, input, .stTextArea textarea {{
 
 
34
  background-color: {colors["panel"]} !important;
35
  color: {colors["text"]} !important;
36
  border: 1px solid {colors["border"]} !important;
37
  border-radius: 4px !important;
38
  }}
 
 
 
 
 
 
 
 
39
  label[data-testid="stMarkdownContainer"] > div > div {{
40
  color: {colors["text"]} !important;
41
  }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  </style>
43
  """, unsafe_allow_html=True)
 
 
 
 
 
 
 
 
1
  def apply_theme(theme):
2
+ import streamlit as st
3
+
4
  LIGHT = {
5
  "bg": "#f5f5f5",
6
  "panel": "#ffffff",
7
  "text": "#1a1a1a",
8
+ "border": "#dddddd",
9
+ "button": "#ff5252",
10
+ "button_text": "#ffffff",
11
+ "placeholder": "#888888"
12
  }
13
  DARK = {
14
  "bg": "#0f1620",
15
  "panel": "#1c2330",
16
  "text": "#e3e8f1",
17
+ "border": "#2a3240",
18
+ "button": "#ff5252",
19
+ "button_text": "#ffffff",
20
+ "placeholder": "#999999"
21
  }
22
 
23
  colors = DARK if theme == "dark" else LIGHT
24
 
25
  st.markdown(f"""
26
  <style>
27
+ /* Background & global text */
28
  .stApp {{
29
  background-color: {colors["bg"]};
30
  color: {colors["text"]};
31
  }}
32
+
33
+ /* Sidebar */
34
  [data-testid="stSidebar"] {{
35
  background-color: {colors["panel"]} !important;
36
  }}
37
+
38
+ /* Form elements */
39
+ textarea, input[type="text"], .stTextArea textarea {{
40
  background-color: {colors["panel"]} !important;
41
  color: {colors["text"]} !important;
42
  border: 1px solid {colors["border"]} !important;
43
  border-radius: 4px !important;
44
  }}
45
+
46
+ /* Placeholder styling */
47
+ textarea::placeholder,
48
+ input::placeholder {{
49
+ color: {colors["placeholder"]} !important;
50
+ }}
51
+
52
+ /* Markdown label text */
53
  label[data-testid="stMarkdownContainer"] > div > div {{
54
  color: {colors["text"]} !important;
55
  }}
56
+
57
+ /* Button */
58
+ button, .stButton > button, .stDownloadButton > button {{
59
+ background-color: {colors["button"]} !important;
60
+ color: {colors["button_text"]} !important;
61
+ border-radius: 6px !important;
62
+ border: none !important;
63
+ transition: transform 0.1s;
64
+ }}
65
+ button:hover {{
66
+ transform: scale(1.02) !important;
67
+ }}
68
+
69
+ /* Radio buttons */
70
+ .stRadio > label {{
71
+ color: {colors["text"]} !important;
72
+ }}
73
+
74
+ /* Assistant styles */
75
+ .chat-container {{
76
+ background: {colors["panel"]} !important;
77
+ border: 1px solid {colors["border"]} !important;
78
+ border-radius: 8px !important;
79
+ padding: 1rem;
80
+ max-height: 480px;
81
+ overflow-y: auto;
82
+ }}
83
+ .chat-message {{
84
+ margin-bottom: 1rem;
85
+ padding: 0.75rem 1rem;
86
+ border-radius: 12px;
87
+ }}
88
+ .user-message {{
89
+ background: rgba(100,149,237,0.2);
90
+ align-self: flex-end;
91
+ }}
92
+ .bot-message {{
93
+ background: rgba(200,200,200,0.2);
94
+ align-self: flex-start;
95
+ }}
96
+ pre code {{
97
+ display: block;
98
+ padding: 0.5rem;
99
+ background: rgba(0,0,0,0.1);
100
+ border-radius: 4px;
101
+ overflow-x: auto;
102
+ }}
103
  </style>
104
  """, unsafe_allow_html=True)