Spaces:
Sleeping
Sleeping
updating theme
Browse files
layout.py
CHANGED
|
@@ -7,7 +7,6 @@ def init_session_state():
|
|
| 7 |
st.session_state.setdefault("stdin", "")
|
| 8 |
st.session_state.setdefault("language", "Python")
|
| 9 |
|
| 10 |
-
|
| 11 |
def apply_theme():
|
| 12 |
"""Apply the selected theme and return color palette + ACE theme."""
|
| 13 |
dark = st.session_state.dark_mode
|
|
@@ -21,10 +20,9 @@ def apply_theme():
|
|
| 21 |
"shadow": "rgba(0,0,0,0.3)" if dark else "rgba(0,0,0,0.1)",
|
| 22 |
}
|
| 23 |
|
| 24 |
-
# Normalize ACE editor theme and language
|
| 25 |
ace_theme = "monokai" if dark else "chrome"
|
| 26 |
-
lang = st.session_state.get("language", "python").lower()
|
| 27 |
|
|
|
|
| 28 |
ace_lang_map = {
|
| 29 |
"c++": "c_cpp",
|
| 30 |
"c#": "csharp",
|
|
@@ -33,29 +31,38 @@ def apply_theme():
|
|
| 33 |
"java": "java",
|
| 34 |
"c": "c"
|
| 35 |
}
|
| 36 |
-
ace_lang = ace_lang_map.get(lang, "python")
|
| 37 |
|
| 38 |
-
# Inject theme
|
| 39 |
st.markdown(
|
| 40 |
f"""
|
| 41 |
<style>
|
| 42 |
.stApp {{
|
| 43 |
background-color: {colors["bg"]};
|
| 44 |
color: {colors["text"]};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
}}
|
| 46 |
[data-testid="stSidebar"] {{
|
| 47 |
background-color: {colors["panel_bg"]} !important;
|
|
|
|
| 48 |
}}
|
| 49 |
.ace_editor, .ace_scroller {{
|
| 50 |
background: {colors["panel_bg"]} !important;
|
| 51 |
box-shadow: 0 4px 8px {colors["shadow"]} !important;
|
| 52 |
border-radius: 8px !important;
|
|
|
|
| 53 |
}}
|
| 54 |
textarea, input, .stTextArea textarea {{
|
| 55 |
background: {colors["panel_bg"]} !important;
|
| 56 |
color: {colors["text"]} !important;
|
| 57 |
border: 1px solid {colors["border"]} !important;
|
| 58 |
border-radius: 4px !important;
|
|
|
|
| 59 |
}}
|
| 60 |
label, .stTextLabel, .stTextArea label {{
|
| 61 |
color: {colors["text"]} !important;
|
|
@@ -64,10 +71,10 @@ def apply_theme():
|
|
| 64 |
background-color: {colors["accent"]} !important;
|
| 65 |
color: #fff !important;
|
| 66 |
border-radius: 6px !important;
|
| 67 |
-
transition: transform 0.
|
| 68 |
}}
|
| 69 |
button:hover {{
|
| 70 |
-
transform: scale(1.
|
| 71 |
}}
|
| 72 |
.chat-container {{
|
| 73 |
background: {colors["panel_bg"]} !important;
|
|
@@ -76,6 +83,7 @@ def apply_theme():
|
|
| 76 |
padding: 1rem;
|
| 77 |
max-height: 480px;
|
| 78 |
overflow-y: auto;
|
|
|
|
| 79 |
}}
|
| 80 |
.chat-message {{
|
| 81 |
margin-bottom: 1rem;
|
|
@@ -103,3 +111,4 @@ def apply_theme():
|
|
| 103 |
)
|
| 104 |
|
| 105 |
return colors, ace_theme
|
|
|
|
|
|
| 7 |
st.session_state.setdefault("stdin", "")
|
| 8 |
st.session_state.setdefault("language", "Python")
|
| 9 |
|
|
|
|
| 10 |
def apply_theme():
|
| 11 |
"""Apply the selected theme and return color palette + ACE theme."""
|
| 12 |
dark = st.session_state.dark_mode
|
|
|
|
| 20 |
"shadow": "rgba(0,0,0,0.3)" if dark else "rgba(0,0,0,0.1)",
|
| 21 |
}
|
| 22 |
|
|
|
|
| 23 |
ace_theme = "monokai" if dark else "chrome"
|
|
|
|
| 24 |
|
| 25 |
+
lang = st.session_state.get("language", "python").lower()
|
| 26 |
ace_lang_map = {
|
| 27 |
"c++": "c_cpp",
|
| 28 |
"c#": "csharp",
|
|
|
|
| 31 |
"java": "java",
|
| 32 |
"c": "c"
|
| 33 |
}
|
| 34 |
+
ace_lang = ace_lang_map.get(lang, "python")
|
| 35 |
|
| 36 |
+
# Inject polished theme CSS
|
| 37 |
st.markdown(
|
| 38 |
f"""
|
| 39 |
<style>
|
| 40 |
.stApp {{
|
| 41 |
background-color: {colors["bg"]};
|
| 42 |
color: {colors["text"]};
|
| 43 |
+
transition: background-color 0.3s ease, color 0.3s ease;
|
| 44 |
+
animation: fadeIn 0.4s ease;
|
| 45 |
+
}}
|
| 46 |
+
@keyframes fadeIn {{
|
| 47 |
+
from {{ opacity: 0; transform: translateY(10px); }}
|
| 48 |
+
to {{ opacity: 1; transform: translateY(0); }}
|
| 49 |
}}
|
| 50 |
[data-testid="stSidebar"] {{
|
| 51 |
background-color: {colors["panel_bg"]} !important;
|
| 52 |
+
transition: background-color 0.3s ease;
|
| 53 |
}}
|
| 54 |
.ace_editor, .ace_scroller {{
|
| 55 |
background: {colors["panel_bg"]} !important;
|
| 56 |
box-shadow: 0 4px 8px {colors["shadow"]} !important;
|
| 57 |
border-radius: 8px !important;
|
| 58 |
+
transition: background-color 0.3s ease;
|
| 59 |
}}
|
| 60 |
textarea, input, .stTextArea textarea {{
|
| 61 |
background: {colors["panel_bg"]} !important;
|
| 62 |
color: {colors["text"]} !important;
|
| 63 |
border: 1px solid {colors["border"]} !important;
|
| 64 |
border-radius: 4px !important;
|
| 65 |
+
transition: background-color 0.3s ease, color 0.3s ease;
|
| 66 |
}}
|
| 67 |
label, .stTextLabel, .stTextArea label {{
|
| 68 |
color: {colors["text"]} !important;
|
|
|
|
| 71 |
background-color: {colors["accent"]} !important;
|
| 72 |
color: #fff !important;
|
| 73 |
border-radius: 6px !important;
|
| 74 |
+
transition: background-color 0.3s ease, transform 0.2s ease;
|
| 75 |
}}
|
| 76 |
button:hover {{
|
| 77 |
+
transform: scale(1.05) !important;
|
| 78 |
}}
|
| 79 |
.chat-container {{
|
| 80 |
background: {colors["panel_bg"]} !important;
|
|
|
|
| 83 |
padding: 1rem;
|
| 84 |
max-height: 480px;
|
| 85 |
overflow-y: auto;
|
| 86 |
+
transition: background-color 0.3s ease;
|
| 87 |
}}
|
| 88 |
.chat-message {{
|
| 89 |
margin-bottom: 1rem;
|
|
|
|
| 111 |
)
|
| 112 |
|
| 113 |
return colors, ace_theme
|
| 114 |
+
|