prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Some labels in Altair charts are hard to see in dark mode
  ### Summary
  
  Streamlit has an awesome feature where it changes the label colors of Altair charts when you switch to dark mode. Sweet!
  
  However, it seems that some labels were omitted and thus remain almost illegibly dark in dark mode.
  
  ### Steps to reproduce
  
  Run this code snippet [taken from the Altair documentation](https://altair-viz.github.io/gallery/grouped_bar_chart.html):
  
  ```python
  from vega_datasets import data
  
  st.subheader("barley example")
  source = data.barley()
  st.write(source)
  st.write(
      alt.Chart(source)
      .mark_bar()
      .encode(x="year:O", y="sum(yield):Q", color="year:N", column="site:N")
  )
  ```
  
  ### Expected  vs actual behavior
  
  In light mode it displays properly:
  
  ![image](https://user-images.githubusercontent.com/1673013/120058948-18e49300-c003-11eb-8b03-7010272c76de.png)
  
  but in dark mode some of the labels have remained black and are almost impossible to read:
  
  ![image](https://user-images.githubusercontent.com/1673013/120058943-09654a00-c003-11eb-9784-4eb36a336153.png)
  
  **Note:** I have marked the errors in red.
  
  ### Is this a regression?
  
  Not sure.
  
  ### Debug info
  
  - Streamlit version: `Streamlit, version 0.82.0`
  - Python version: `Python 3.8.5`
  - PipEnv: `pipenv, version 2020.11.15`
  - OS version: `Ubuntu 20.04.2 LTS`
  - Browser version: `Version 91.0.4472.77 (Official Build) (x86_64)`
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `e2e/scripts/st_arrow_altair_chart.py`
  Content:
  ```
  1 # Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022)
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 #     http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 
  15 import altair as alt
  16 import numpy as np
  17 import pandas as pd
  18 
  19 import streamlit as st
  20 
  21 np.random.seed(0)
  22 
  23 data = np.random.randn(200, 3)
  24 df = pd.DataFrame(data, columns=["a", "b", "c"])
  25 chart = alt.Chart(df).mark_circle().encode(x="a", y="b", size="c", color="c")
  26 st._arrow_altair_chart(chart, theme=None)
  27 
  28 st.write("Show default vega lite theme:")
  29 st._arrow_altair_chart(chart, theme=None)
  30 
  31 st.write("Show streamlit theme:")
  32 st._arrow_altair_chart(chart, theme="streamlit")
  33 
  34 st.write("Overwrite theme config:")
  35 chart = (
  36     alt.Chart(df, usermeta={"embedOptions": {"theme": None}})
  37     .mark_circle()
  38     .encode(x="a", y="b", size="c", color="c")
  39 )
  40 st._arrow_altair_chart(chart, theme="streamlit")
  41 
  42 data = pd.DataFrame(
  43     {
  44         "a": ["A", "B", "C", "D", "E", "F", "G", "H", "I"],
  45         "b": [28, 55, 43, 91, 81, 53, 19, 87, 52],
  46     }
  47 )
  48 
  49 chart = alt.Chart(data).mark_bar().encode(x="a", y="b")
  50 
  51 st.write("Bar chart with default theme:")
  52 st._arrow_altair_chart(chart)
  53 
  54 st.write("Bar chart with streamlit theme:")
  55 st._arrow_altair_chart(chart, theme="streamlit")
  56 
  57 st.write("Bar chart with overwritten theme props:")
  58 st._arrow_altair_chart(chart.configure_mark(color="black"), theme="streamlit")
  59 
  60 # mark_arc was added in 4.2, but we have to support altair 4.0-4.1, so we
  61 # have to skip this part of the test when testing min versions.
  62 major, minor, patch = alt.__version__.split(".")
  63 if not (major == "4" and minor < "2"):
  64 
  65     source = pd.DataFrame(
  66         {"category": [1, 2, 3, 4, 5, 6], "value": [4, 6, 10, 3, 7, 8]}
  67     )
  68 
  69     chart = (
  70         alt.Chart(source)
  71         .mark_arc(innerRadius=50)
  72         .encode(
  73             theta=alt.Theta(field="value", type="quantitative"),
  74             color=alt.Color(field="category", type="nominal"),
  75         )
  76     )
  77 
  78     st.write("Pie Chart with more than 4 Legend items")
  79     st._arrow_altair_chart(chart, theme="streamlit")
  80
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/e2e/scripts/st_arrow_altair_chart.py b/e2e/scripts/st_arrow_altair_chart.py
  --- a/e2e/scripts/st_arrow_altair_chart.py
  +++ b/e2e/scripts/st_arrow_altair_chart.py
  @@ -48,12 +48,6 @@
   
   chart = alt.Chart(data).mark_bar().encode(x="a", y="b")
   
  -st.write("Bar chart with default theme:")
  -st._arrow_altair_chart(chart)
  -
  -st.write("Bar chart with streamlit theme:")
  -st._arrow_altair_chart(chart, theme="streamlit")
  -
   st.write("Bar chart with overwritten theme props:")
   st._arrow_altair_chart(chart.configure_mark(color="black"), theme="streamlit")
   
  @@ -77,3 +71,20 @@
   
       st.write("Pie Chart with more than 4 Legend items")
       st._arrow_altair_chart(chart, theme="streamlit")
  +
  +# taken from vega_datasets barley example
  +barley = alt.UrlData(
  +    "https://cdn.jsdelivr.net/npm/vega-datasets@v2.7.0/data/barley.json"
  +)
  +
  +barley_chart = (
  +    alt.Chart(barley)
  +    .mark_bar()
  +    .encode(x="year:O", y="sum(yield):Q", color="year:N", column="site:N")
  +)
  +
  +st.write("Grouped Bar Chart with default theme:")
  +st.altair_chart(barley_chart, theme=None)
  +
  +st.write("Grouped Bar Chart with streamlit theme:")
  +st.altair_chart(barley_chart, theme="streamlit")
  
verification_info: {"golden_diff": "diff --git a/e2e/scripts/st_arrow_altair_chart.py b/e2e/scripts/st_arrow_altair_chart.py\n--- a/e2e/scripts/st_arrow_altair_chart.py\n+++ b/e2e/scripts/st_arrow_altair_chart.py\n@@ -48,12 +48,6 @@\n \n chart = alt.Chart(data).mark_bar().encode(x=\"a\", y=\"b\")\n \n-st.write(\"Bar chart with default theme:\")\n-st._arrow_altair_chart(chart)\n-\n-st.write(\"Bar chart with streamlit theme:\")\n-st._arrow_altair_chart(chart, theme=\"streamlit\")\n-\n st.write(\"Bar chart with overwritten theme props:\")\n st._arrow_altair_chart(chart.configure_mark(color=\"black\"), theme=\"streamlit\")\n \n@@ -77,3 +71,20 @@\n \n     st.write(\"Pie Chart with more than 4 Legend items\")\n     st._arrow_altair_chart(chart, theme=\"streamlit\")\n+\n+# taken from vega_datasets barley example\n+barley = alt.UrlData(\n+    \"https://cdn.jsdelivr.net/npm/vega-datasets@v2.7.0/data/barley.json\"\n+)\n+\n+barley_chart = (\n+    alt.Chart(barley)\n+    .mark_bar()\n+    .encode(x=\"year:O\", y=\"sum(yield):Q\", color=\"year:N\", column=\"site:N\")\n+)\n+\n+st.write(\"Grouped Bar Chart with default theme:\")\n+st.altair_chart(barley_chart, theme=None)\n+\n+st.write(\"Grouped Bar Chart with streamlit theme:\")\n+st.altair_chart(barley_chart, theme=\"streamlit\")\n", "issue": "Some labels in Altair charts are hard to see in dark mode\n### Summary\r\n\r\nStreamlit has an awesome feature where it changes the label colors of Altair charts when you switch to dark mode. Sweet!\r\n\r\nHowever, it seems that some labels were omitted and thus remain almost illegibly dark in dark mode.\r\n\r\n### Steps to reproduce\r\n\r\nRun this code snippet [taken from the Altair documentation](https://altair-viz.github.io/gallery/grouped_bar_chart.html):\r\n\r\n```python\r\nfrom vega_datasets import data\r\n\r\nst.subheader(\"barley example\")\r\nsource = data.barley()\r\nst.write(source)\r\nst.write(\r\n    alt.Chart(source)\r\n    .mark_bar()\r\n    .encode(x=\"year:O\", y=\"sum(yield):Q\", color=\"year:N\", column=\"site:N\")\r\n)\r\n```\r\n\r\n### Expected  vs actual behavior\r\n\r\nIn light mode it displays properly:\r\n\r\n![image](https://user-images.githubusercontent.com/1673013/120058948-18e49300-c003-11eb-8b03-7010272c76de.png)\r\n\r\nbut in dark mode some of the labels have remained black and are almost impossible to read:\r\n\r\n![image](https://user-images.githubusercontent.com/1673013/120058943-09654a00-c003-11eb-9784-4eb36a336153.png)\r\n\r\n**Note:** I have marked the errors in red.\r\n\r\n### Is this a regression?\r\n\r\nNot sure.\r\n\r\n### Debug info\r\n\r\n- Streamlit version: `Streamlit, version 0.82.0`\r\n- Python version: `Python 3.8.5`\r\n- PipEnv: `pipenv, version 2020.11.15`\r\n- OS version: `Ubuntu 20.04.2 LTS`\r\n- Browser version: `Version 91.0.4472.77 (Official Build) (x86_64)`\r\n\n", "before_files": [{"content": "# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022)\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport altair as alt\nimport numpy as np\nimport pandas as pd\n\nimport streamlit as st\n\nnp.random.seed(0)\n\ndata = np.random.randn(200, 3)\ndf = pd.DataFrame(data, columns=[\"a\", \"b\", \"c\"])\nchart = alt.Chart(df).mark_circle().encode(x=\"a\", y=\"b\", size=\"c\", color=\"c\")\nst._arrow_altair_chart(chart, theme=None)\n\nst.write(\"Show default vega lite theme:\")\nst._arrow_altair_chart(chart, theme=None)\n\nst.write(\"Show streamlit theme:\")\nst._arrow_altair_chart(chart, theme=\"streamlit\")\n\nst.write(\"Overwrite theme config:\")\nchart = (\n    alt.Chart(df, usermeta={\"embedOptions\": {\"theme\": None}})\n    .mark_circle()\n    .encode(x=\"a\", y=\"b\", size=\"c\", color=\"c\")\n)\nst._arrow_altair_chart(chart, theme=\"streamlit\")\n\ndata = pd.DataFrame(\n    {\n        \"a\": [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\"],\n        \"b\": [28, 55, 43, 91, 81, 53, 19, 87, 52],\n    }\n)\n\nchart = alt.Chart(data).mark_bar().encode(x=\"a\", y=\"b\")\n\nst.write(\"Bar chart with default theme:\")\nst._arrow_altair_chart(chart)\n\nst.write(\"Bar chart with streamlit theme:\")\nst._arrow_altair_chart(chart, theme=\"streamlit\")\n\nst.write(\"Bar chart with overwritten theme props:\")\nst._arrow_altair_chart(chart.configure_mark(color=\"black\"), theme=\"streamlit\")\n\n# mark_arc was added in 4.2, but we have to support altair 4.0-4.1, so we\n# have to skip this part of the test when testing min versions.\nmajor, minor, patch = alt.__version__.split(\".\")\nif not (major == \"4\" and minor < \"2\"):\n\n    source = pd.DataFrame(\n        {\"category\": [1, 2, 3, 4, 5, 6], \"value\": [4, 6, 10, 3, 7, 8]}\n    )\n\n    chart = (\n        alt.Chart(source)\n        .mark_arc(innerRadius=50)\n        .encode(\n            theta=alt.Theta(field=\"value\", type=\"quantitative\"),\n            color=alt.Color(field=\"category\", type=\"nominal\"),\n        )\n    )\n\n    st.write(\"Pie Chart with more than 4 Legend items\")\n    st._arrow_altair_chart(chart, theme=\"streamlit\")\n", "path": "e2e/scripts/st_arrow_altair_chart.py"}], "after_files": [{"content": "# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022)\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport altair as alt\nimport numpy as np\nimport pandas as pd\n\nimport streamlit as st\n\nnp.random.seed(0)\n\ndata = np.random.randn(200, 3)\ndf = pd.DataFrame(data, columns=[\"a\", \"b\", \"c\"])\nchart = alt.Chart(df).mark_circle().encode(x=\"a\", y=\"b\", size=\"c\", color=\"c\")\nst._arrow_altair_chart(chart, theme=None)\n\nst.write(\"Show default vega lite theme:\")\nst._arrow_altair_chart(chart, theme=None)\n\nst.write(\"Show streamlit theme:\")\nst._arrow_altair_chart(chart, theme=\"streamlit\")\n\nst.write(\"Overwrite theme config:\")\nchart = (\n    alt.Chart(df, usermeta={\"embedOptions\": {\"theme\": None}})\n    .mark_circle()\n    .encode(x=\"a\", y=\"b\", size=\"c\", color=\"c\")\n)\nst._arrow_altair_chart(chart, theme=\"streamlit\")\n\ndata = pd.DataFrame(\n    {\n        \"a\": [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\"],\n        \"b\": [28, 55, 43, 91, 81, 53, 19, 87, 52],\n    }\n)\n\nchart = alt.Chart(data).mark_bar().encode(x=\"a\", y=\"b\")\n\nst.write(\"Bar chart with overwritten theme props:\")\nst._arrow_altair_chart(chart.configure_mark(color=\"black\"), theme=\"streamlit\")\n\n# mark_arc was added in 4.2, but we have to support altair 4.0-4.1, so we\n# have to skip this part of the test when testing min versions.\nmajor, minor, patch = alt.__version__.split(\".\")\nif not (major == \"4\" and minor < \"2\"):\n\n    source = pd.DataFrame(\n        {\"category\": [1, 2, 3, 4, 5, 6], \"value\": [4, 6, 10, 3, 7, 8]}\n    )\n\n    chart = (\n        alt.Chart(source)\n        .mark_arc(innerRadius=50)\n        .encode(\n            theta=alt.Theta(field=\"value\", type=\"quantitative\"),\n            color=alt.Color(field=\"category\", type=\"nominal\"),\n        )\n    )\n\n    st.write(\"Pie Chart with more than 4 Legend items\")\n    st._arrow_altair_chart(chart, theme=\"streamlit\")\n\n# taken from vega_datasets barley example\nbarley = alt.UrlData(\n    \"https://cdn.jsdelivr.net/npm/vega-datasets@v2.7.0/data/barley.json\"\n)\n\nbarley_chart = (\n    alt.Chart(barley)\n    .mark_bar()\n    .encode(x=\"year:O\", y=\"sum(yield):Q\", color=\"year:N\", column=\"site:N\")\n)\n\nst.write(\"Grouped Bar Chart with default theme:\")\nst.altair_chart(barley_chart, theme=None)\n\nst.write(\"Grouped Bar Chart with streamlit theme:\")\nst.altair_chart(barley_chart, theme=\"streamlit\")\n", "path": "e2e/scripts/st_arrow_altair_chart.py"}]}