vsj0702 commited on
Commit
52e48a9
·
verified ·
1 Parent(s): 20b0673

Adding style.py

Browse files
Files changed (1) hide show
  1. styles.py +58 -0
styles.py ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def get_theme_colors(dm):
2
+ return {
3
+ "BG": "#0f1620" if dm else "#f5f5f5",
4
+ "PANEL_BG": "#1c2330" if dm else "#ffffff",
5
+ "TEXT": "#e3e8f1" if dm else "#1a1a1a",
6
+ "ACCENT": "#ff5252",
7
+ "BORDER": "#2a3240" if dm else "#dddddd",
8
+ "SHADOW": "rgba(0,0,0,0.3)" if dm else "rgba(0,0,0,0.1)",
9
+ "ACE_THEME": "monokai" if dm else "chrome",
10
+ }
11
+
12
+ def inject_global_css(colors):
13
+ import streamlit as st
14
+ st.markdown(f"""
15
+ <style>
16
+ .stApp {{ background-color: {colors["BG"]}; color: {colors["TEXT"]}; }}
17
+ [data-testid="stSidebar"] {{ background-color: {colors["PANEL_BG"]} !important; }}
18
+ .ace_editor, .ace_scroller {{
19
+ background: {colors["PANEL_BG"]} !important;
20
+ box-shadow: 0 4px 8px {colors["SHADOW"]} !important;
21
+ border-radius: 8px !important;
22
+ }}
23
+ textarea, input, .stTextArea textarea {{
24
+ background: {colors["PANEL_BG"]} !important;
25
+ color: {colors["TEXT"]} !important;
26
+ border: 1px solid {colors["BORDER"]} !important;
27
+ border-radius: 4px !important;
28
+ }}
29
+ button, .stDownloadButton > button {{
30
+ background-color: {colors["ACCENT"]} !important;
31
+ color: #fff !important;
32
+ border-radius: 6px !important;
33
+ transition: transform 0.1s;
34
+ }}
35
+ button:hover {{ transform: scale(1.02) !important; }}
36
+ .chat-container {{
37
+ background: {colors["PANEL_BG"]} !important;
38
+ border: 1px solid {colors["BORDER"]} !important;
39
+ border-radius: 8px !important;
40
+ padding: 1rem;
41
+ max-height: 480px;
42
+ overflow-y: auto;
43
+ }}
44
+ .chat-message {{ margin-bottom: 1rem; padding: 0.75rem 1rem; border-radius: 12px; }}
45
+ .user-message {{ background: rgba(100,149,237,0.2); align-self: flex-end; }}
46
+ .bot-message {{ background: rgba(200,200,200,0.2); align-self: flex-start; }}
47
+ pre code {{
48
+ display: block;
49
+ padding: 0.5rem;
50
+ background: rgba(0,0,0,0.1);
51
+ border-radius: 4px;
52
+ overflow-x: auto;
53
+ }}
54
+ label[data-testid="stMarkdownContainer"] > div > div {{
55
+ color: {colors["TEXT"]} !important;
56
+ }}
57
+ </style>
58
+ """, unsafe_allow_html=True)