hblim commited on
Commit
cb1126c
·
1 Parent(s): e3f9537

Adjust legend text color

Browse files
Files changed (1) hide show
  1. frontend/app.py +4 -1
frontend/app.py CHANGED
@@ -234,6 +234,9 @@ legend_df = pd.DataFrame({
234
  "shape": ["circle", "square"],
235
  })
236
 
 
 
 
237
  legend_points = (
238
  alt.Chart(legend_df)
239
  .mark_point(size=100, filled=True)
@@ -248,7 +251,7 @@ legend_points = (
248
 
249
  legend_text = (
250
  alt.Chart(legend_df)
251
- .mark_text(align="left", baseline="middle", dx=15)
252
  .encode(
253
  y="row:O",
254
  x=alt.value(0),
 
234
  "shape": ["circle", "square"],
235
  })
236
 
237
+ # Retrieve the current theme's text color so legend text adapts to light/dark mode
238
+ text_color = st.get_option("theme.textColor") or "#000000"
239
+
240
  legend_points = (
241
  alt.Chart(legend_df)
242
  .mark_point(size=100, filled=True)
 
251
 
252
  legend_text = (
253
  alt.Chart(legend_df)
254
+ .mark_text(align="left", baseline="middle", dx=15, color=text_color)
255
  .encode(
256
  y="row:O",
257
  x=alt.value(0),