Gen. Overseer Lupo commited on
Commit
1b1457f
·
1 Parent(s): 9344898

Fix select/multiselect to dark theme using role/testid selectors

Browse files
Files changed (1) hide show
  1. app/ui_streamlit.py +59 -0
app/ui_streamlit.py CHANGED
@@ -88,6 +88,65 @@ span.chip { display:inline-block; padding:3px 8px; border-radius:999px; backgrou
88
  .hero-text { height:100%; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; color:#fff; }
89
  .hero-text h1 { margin:0; font-size:28px; font-weight:700; color:#f97316; }
90
  .hero-text p { margin:6px 0 0; font-size:15px; color:#fcd34d; } /* gold */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  </style>
92
  """, unsafe_allow_html=True)
93
 
 
88
  .hero-text { height:100%; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; color:#fff; }
89
  .hero-text h1 { margin:0; font-size:28px; font-weight:700; color:#f97316; }
90
  .hero-text p { margin:6px 0 0; font-size:15px; color:#fcd34d; } /* gold */
91
+
92
+
93
+
94
+ /* ===== FORCE DARK SELECT / MULTISELECT (works across Streamlit versions) ===== */
95
+
96
+ /* Closed control (the visible box) */
97
+ [data-testid="stSelectbox"] div[role="combobox"],
98
+ [data-testid="stMultiSelect"] div[role="combobox"],
99
+ div[role="combobox"][aria-haspopup="listbox"] {
100
+ background-color: #1e293b !important;
101
+ color: #f8fafc !important;
102
+ border: 1px solid #334155 !important;
103
+ border-radius: 8px !important;
104
+ }
105
+
106
+ /* Input text & caret */
107
+ [data-testid="stSelectbox"] div[role="combobox"] input,
108
+ [data-testid="stMultiSelect"] div[role="combobox"] input,
109
+ div[role="combobox"] input {
110
+ color: #f8fafc !important;
111
+ }
112
+ div[role="combobox"] input::placeholder { color: #94a3b8 !important; }
113
+ div[role="combobox"] svg { color: #f8fafc !important; fill: #f8fafc !important; }
114
+
115
+ /* Multiselect selected chips */
116
+ [data-testid="stMultiSelect"] [data-baseweb="tag"],
117
+ [data-testid="stMultiSelect"] [aria-label="remove"] {
118
+ background-color: #334155 !important;
119
+ color: #e2e8f0 !important;
120
+ border-radius: 999px !important;
121
+ }
122
+
123
+ /* Open dropdown panel (menu) */
124
+ div[role="listbox"],
125
+ ul[role="listbox"],
126
+ div[data-baseweb="menu"] {
127
+ background-color: #0b1220 !important;
128
+ color: #f8fafc !important;
129
+ border: 1px solid #334155 !important;
130
+ border-radius: 10px !important;
131
+ }
132
+
133
+ /* Options inside the menu */
134
+ [role="listbox"] [role="option"],
135
+ div[data-baseweb="menu"] [role="option"] {
136
+ background: transparent !important;
137
+ color: #f8fafc !important;
138
+ }
139
+ [role="listbox"] [role="option"]:hover,
140
+ div[data-baseweb="menu"] [role="option"]:hover {
141
+ background: #1f2937 !important;
142
+ }
143
+ [role="listbox"] [role="option"][aria-selected="true"],
144
+ div[data-baseweb="menu"] [role="option"][aria-selected="true"] {
145
+ background: #334155 !important;
146
+ color: #f8fafc !important;
147
+ }
148
+
149
+
150
  </style>
151
  """, unsafe_allow_html=True)
152