streamlit 1.49.1__py3-none-any.whl → 1.51.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (259) hide show
  1. streamlit/__init__.py +4 -1
  2. streamlit/column_config.py +2 -0
  3. streamlit/commands/navigation.py +7 -7
  4. streamlit/commands/page_config.py +4 -6
  5. streamlit/components/v1/custom_component.py +17 -42
  6. streamlit/components/v2/__init__.py +458 -0
  7. streamlit/components/v2/bidi_component/__init__.py +20 -0
  8. streamlit/components/v2/bidi_component/constants.py +29 -0
  9. streamlit/components/v2/bidi_component/main.py +386 -0
  10. streamlit/components/v2/bidi_component/serialization.py +265 -0
  11. streamlit/components/v2/bidi_component/state.py +92 -0
  12. streamlit/components/v2/component_definition_resolver.py +143 -0
  13. streamlit/components/v2/component_file_watcher.py +403 -0
  14. streamlit/components/v2/component_manager.py +431 -0
  15. streamlit/components/v2/component_manifest_handler.py +122 -0
  16. streamlit/components/v2/component_path_utils.py +245 -0
  17. streamlit/components/v2/component_registry.py +409 -0
  18. streamlit/components/v2/get_bidi_component_manager.py +51 -0
  19. streamlit/components/v2/manifest_scanner.py +615 -0
  20. streamlit/components/v2/presentation.py +198 -0
  21. streamlit/components/v2/types.py +324 -0
  22. streamlit/config.py +741 -32
  23. streamlit/config_option.py +4 -1
  24. streamlit/config_util.py +650 -1
  25. streamlit/connections/base_connection.py +4 -2
  26. streamlit/dataframe_util.py +18 -10
  27. streamlit/delta_generator.py +8 -7
  28. streamlit/delta_generator_singletons.py +3 -1
  29. streamlit/deprecation_util.py +17 -6
  30. streamlit/elements/arrow.py +90 -42
  31. streamlit/elements/deck_gl_json_chart.py +98 -39
  32. streamlit/elements/dialog_decorator.py +2 -1
  33. streamlit/elements/exception.py +3 -1
  34. streamlit/elements/form.py +6 -6
  35. streamlit/elements/graphviz_chart.py +24 -9
  36. streamlit/elements/heading.py +3 -5
  37. streamlit/elements/iframe.py +0 -2
  38. streamlit/elements/image.py +12 -13
  39. streamlit/elements/layouts.py +89 -22
  40. streamlit/elements/lib/built_in_chart_utils.py +95 -31
  41. streamlit/elements/lib/color_util.py +8 -18
  42. streamlit/elements/lib/column_config_utils.py +9 -8
  43. streamlit/elements/lib/column_types.py +595 -148
  44. streamlit/elements/lib/dialog.py +3 -2
  45. streamlit/elements/lib/image_utils.py +3 -5
  46. streamlit/elements/lib/layout_utils.py +50 -13
  47. streamlit/elements/lib/mutable_status_container.py +2 -2
  48. streamlit/elements/lib/options_selector_utils.py +2 -2
  49. streamlit/elements/lib/pandas_styler_utils.py +30 -14
  50. streamlit/elements/lib/utils.py +21 -9
  51. streamlit/elements/map.py +81 -40
  52. streamlit/elements/media.py +7 -7
  53. streamlit/elements/metric.py +11 -35
  54. streamlit/elements/pdf.py +2 -4
  55. streamlit/elements/plotly_chart.py +142 -26
  56. streamlit/elements/progress.py +2 -4
  57. streamlit/elements/pyplot.py +6 -6
  58. streamlit/elements/space.py +113 -0
  59. streamlit/elements/vega_charts.py +400 -143
  60. streamlit/elements/widgets/audio_input.py +52 -4
  61. streamlit/elements/widgets/button.py +29 -29
  62. streamlit/elements/widgets/button_group.py +33 -6
  63. streamlit/elements/widgets/camera_input.py +3 -4
  64. streamlit/elements/widgets/chat.py +7 -0
  65. streamlit/elements/widgets/checkbox.py +1 -0
  66. streamlit/elements/widgets/color_picker.py +1 -0
  67. streamlit/elements/widgets/data_editor.py +34 -29
  68. streamlit/elements/widgets/file_uploader.py +6 -10
  69. streamlit/elements/widgets/multiselect.py +14 -3
  70. streamlit/elements/widgets/number_input.py +5 -4
  71. streamlit/elements/widgets/radio.py +10 -2
  72. streamlit/elements/widgets/select_slider.py +8 -4
  73. streamlit/elements/widgets/selectbox.py +9 -2
  74. streamlit/elements/widgets/slider.py +38 -41
  75. streamlit/elements/widgets/text_widgets.py +6 -0
  76. streamlit/elements/widgets/time_widgets.py +15 -12
  77. streamlit/elements/write.py +28 -23
  78. streamlit/emojis.py +1 -1
  79. streamlit/errors.py +115 -0
  80. streamlit/git_util.py +65 -43
  81. streamlit/hello/hello.py +8 -0
  82. streamlit/hello/utils.py +2 -1
  83. streamlit/material_icon_names.py +1 -1
  84. streamlit/navigation/page.py +4 -1
  85. streamlit/proto/ArrowData_pb2.py +27 -0
  86. streamlit/proto/ArrowData_pb2.pyi +46 -0
  87. streamlit/proto/Arrow_pb2.py +10 -8
  88. streamlit/proto/Arrow_pb2.pyi +31 -2
  89. streamlit/proto/AudioInput_pb2.py +2 -2
  90. streamlit/proto/AudioInput_pb2.pyi +6 -2
  91. streamlit/proto/BidiComponent_pb2.py +34 -0
  92. streamlit/proto/BidiComponent_pb2.pyi +153 -0
  93. streamlit/proto/Block_pb2.py +11 -11
  94. streamlit/proto/Block_pb2.pyi +9 -1
  95. streamlit/proto/DeckGlJsonChart_pb2.py +10 -4
  96. streamlit/proto/DeckGlJsonChart_pb2.pyi +9 -3
  97. streamlit/proto/Element_pb2.py +5 -3
  98. streamlit/proto/Element_pb2.pyi +14 -4
  99. streamlit/proto/HeightConfig_pb2.py +2 -2
  100. streamlit/proto/HeightConfig_pb2.pyi +6 -3
  101. streamlit/proto/NewSession_pb2.py +18 -16
  102. streamlit/proto/NewSession_pb2.pyi +158 -6
  103. streamlit/proto/PlotlyChart_pb2.py +8 -6
  104. streamlit/proto/PlotlyChart_pb2.pyi +3 -1
  105. streamlit/proto/Space_pb2.py +27 -0
  106. streamlit/proto/Space_pb2.pyi +42 -0
  107. streamlit/proto/WidgetStates_pb2.py +2 -2
  108. streamlit/proto/WidgetStates_pb2.pyi +13 -3
  109. streamlit/proto/WidthConfig_pb2.py +2 -2
  110. streamlit/proto/WidthConfig_pb2.pyi +6 -3
  111. streamlit/runtime/app_session.py +45 -6
  112. streamlit/runtime/caching/cache_data_api.py +4 -4
  113. streamlit/runtime/caching/cache_errors.py +4 -1
  114. streamlit/runtime/caching/cache_resource_api.py +3 -2
  115. streamlit/runtime/caching/cache_utils.py +2 -1
  116. streamlit/runtime/caching/cached_message_replay.py +3 -3
  117. streamlit/runtime/caching/hashing.py +3 -4
  118. streamlit/runtime/caching/legacy_cache_api.py +2 -1
  119. streamlit/runtime/connection_factory.py +1 -3
  120. streamlit/runtime/forward_msg_queue.py +4 -1
  121. streamlit/runtime/fragment.py +2 -1
  122. streamlit/runtime/memory_media_file_storage.py +1 -1
  123. streamlit/runtime/metrics_util.py +6 -2
  124. streamlit/runtime/runtime.py +14 -0
  125. streamlit/runtime/scriptrunner/exec_code.py +2 -1
  126. streamlit/runtime/scriptrunner/script_runner.py +2 -2
  127. streamlit/runtime/scriptrunner_utils/script_run_context.py +3 -6
  128. streamlit/runtime/secrets.py +2 -4
  129. streamlit/runtime/session_manager.py +3 -1
  130. streamlit/runtime/state/common.py +30 -5
  131. streamlit/runtime/state/presentation.py +85 -0
  132. streamlit/runtime/state/safe_session_state.py +2 -2
  133. streamlit/runtime/state/session_state.py +220 -16
  134. streamlit/runtime/state/widgets.py +19 -3
  135. streamlit/runtime/theme_util.py +148 -0
  136. streamlit/runtime/websocket_session_manager.py +3 -1
  137. streamlit/source_util.py +2 -2
  138. streamlit/static/index.html +2 -2
  139. streamlit/static/manifest.json +244 -227
  140. streamlit/static/static/css/{index.C8X8rNzw.css → index.BpABIXK9.css} +1 -1
  141. streamlit/static/static/css/index.DgR7E2CV.css +1 -0
  142. streamlit/static/static/js/{ErrorOutline.esm.DcGrhbBP.js → ErrorOutline.esm.YoJdlW1p.js} +1 -1
  143. streamlit/static/static/js/{FileDownload.esm.DgBvV6Pq.js → FileDownload.esm.Ddx8VEYy.js} +1 -1
  144. streamlit/static/static/js/{FileHelper.M6AAaeuA.js → FileHelper.90EtOmj9.js} +1 -1
  145. streamlit/static/static/js/{FormClearHelper.DHh1GFzm.js → FormClearHelper.BB1Km6eP.js} +1 -1
  146. streamlit/static/static/js/InputInstructions.jhH15PqV.js +1 -0
  147. streamlit/static/static/js/{Particles.DDVT-6Qc.js → Particles.DUsputn1.js} +1 -1
  148. streamlit/static/static/js/{ProgressBar.BEY0cXXV.js → ProgressBar.DLY8H6nE.js} +2 -2
  149. streamlit/static/static/js/Toolbar.D8nHCkuz.js +1 -0
  150. streamlit/static/static/js/{base-input.CK3UVGp1.js → base-input.CJGiNqed.js} +3 -3
  151. streamlit/static/static/js/{checkbox.D8W881TL.js → checkbox.Cpdd482O.js} +1 -1
  152. streamlit/static/static/js/{createSuper.B6W-Dh9S.js → createSuper.CuQIogbW.js} +1 -1
  153. streamlit/static/static/js/data-grid-overlay-editor.2Ufgxc6y.js +1 -0
  154. streamlit/static/static/js/{downloader.DiKpuU_S.js → downloader.CN0K7xlu.js} +1 -1
  155. streamlit/static/static/js/{es6.B8zRNPZ-.js → es6.BJcsVXQ0.js} +2 -2
  156. streamlit/static/static/js/{iframeResizer.contentWindow.DIewJmmh.js → iframeResizer.contentWindow.XzUvQqcZ.js} +1 -1
  157. streamlit/static/static/js/index.B1ZQh4P1.js +1 -0
  158. streamlit/static/static/js/index.BKstZk0M.js +27 -0
  159. streamlit/static/static/js/{index.Bte_9Lyq.js → index.BMcFsUee.js} +1 -1
  160. streamlit/static/static/js/{index.qhs54UAB.js → index.BR-IdcTb.js} +1 -1
  161. streamlit/static/static/js/{index.CejBxbg1.js → index.B_dWA3vd.js} +1 -1
  162. streamlit/static/static/js/{index.D5naqx-J.js → index.BgnZEMVh.js} +1 -1
  163. streamlit/static/static/js/{index.C7fRKRs4.js → index.BohqXifI.js} +1 -1
  164. streamlit/static/static/js/{index.cnnXF7xQ.js → index.Br5nxKNj.js} +1 -1
  165. streamlit/static/static/js/index.BrIKVbNc.js +3 -0
  166. streamlit/static/static/js/index.BtWUPzle.js +1 -0
  167. streamlit/static/static/js/index.C0RLraek.js +1 -0
  168. streamlit/static/static/js/{index.CP5TD2z1.js → index.CAIjskgG.js} +1 -1
  169. streamlit/static/static/js/{index.CD8HuT3N.js → index.CAj-7vWz.js} +135 -162
  170. streamlit/static/static/js/{index.DtYN2x4k.js → index.CMtEit2O.js} +1 -1
  171. streamlit/static/static/js/index.CkRlykEE.js +12 -0
  172. streamlit/static/static/js/{index.Ts_0SdB9.js → index.CmN3FXfI.js} +2 -2
  173. streamlit/static/static/js/{index.BnEpvLEz.js → index.CwbFI1_-.js} +1 -1
  174. streamlit/static/static/js/{index.CcJf6BCU.js → index.CxIUUfab.js} +27 -27
  175. streamlit/static/static/js/index.D2KPNy7e.js +1 -0
  176. streamlit/static/static/js/{index.Ch7MBCx0.js → index.D3GPA5k4.js} +47 -47
  177. streamlit/static/static/js/{index.ho6NIXGl.js → index.DGAh7DMq.js} +1 -1
  178. streamlit/static/static/js/index.DKb_NvmG.js +197 -0
  179. streamlit/static/static/js/{index.CvYYtxD_.js → index.DMqgUYKq.js} +1 -1
  180. streamlit/static/static/js/{index.zecpGxtj.js → index.DOFlg3dS.js} +1 -1
  181. streamlit/static/static/js/{index.B9mjBcgE.js → index.DPUXkcQL.js} +1 -1
  182. streamlit/static/static/js/index.DX1xY89g.js +1 -0
  183. streamlit/static/static/js/index.DYATBCsq.js +2 -0
  184. streamlit/static/static/js/{index.D2-atlaQ.js → index.DaSmGJ76.js} +3 -3
  185. streamlit/static/static/js/index.Dd7bMeLP.js +1 -0
  186. streamlit/static/static/js/{index.4eF4NxG2.js → index.DjmmgI5U.js} +1 -1
  187. streamlit/static/static/js/index.Dq56CyM2.js +1 -0
  188. streamlit/static/static/js/index.DuiXaS5_.js +7 -0
  189. streamlit/static/static/js/index.DvFidMLe.js +2 -0
  190. streamlit/static/static/js/{index.452cqrrL.js → index.DwkhC5Pc.js} +1 -1
  191. streamlit/static/static/js/{index.Dk4C7X3i.js → index.Q-3sFn1v.js} +1 -1
  192. streamlit/static/static/js/{index.CjXWwH-y.js → index.QJ5QO9sJ.js} +1 -1
  193. streamlit/static/static/js/{index.B6U8LQo3.js → index.VwTaeety.js} +1 -1
  194. streamlit/static/static/js/index.YOqQbeX8.js +1 -0
  195. streamlit/static/static/js/{input.nzVJphXi.js → input.D4MN_FzN.js} +1 -1
  196. streamlit/static/static/js/{memory.CjCgTQz3.js → memory.DrZjtdGT.js} +1 -1
  197. streamlit/static/static/js/{number-overlay-editor.DaRFzZEO.js → number-overlay-editor.DRwAw1In.js} +1 -1
  198. streamlit/static/static/js/{possibleConstructorReturn.DgiPnZ9N.js → possibleConstructorReturn.exeeJQEP.js} +1 -1
  199. streamlit/static/static/js/record.B-tDciZb.js +1 -0
  200. streamlit/static/static/js/{sandbox.mithfq7Z.js → sandbox.ClO3IuUr.js} +1 -1
  201. streamlit/static/static/js/{timepicker.Dbl5KFh6.js → timepicker.DAhu-vcF.js} +4 -4
  202. streamlit/static/static/js/{toConsumableArray.D-Dx88BQ.js → toConsumableArray.DNbljYEC.js} +1 -1
  203. streamlit/static/static/js/{uniqueId.Bh26R_3S.js → uniqueId.oG4Gvj1v.js} +1 -1
  204. streamlit/static/static/js/{useBasicWidgetState.DeK-QJpD.js → useBasicWidgetState.D6sOH6oI.js} +1 -1
  205. streamlit/static/static/js/{useTextInputAutoExpand.4iAdLWD-.js → useTextInputAutoExpand.4u3_GcuN.js} +2 -2
  206. streamlit/static/static/js/{useUpdateUiValue.CmT7_nJN.js → useUpdateUiValue.F2R3eTeR.js} +1 -1
  207. streamlit/static/static/js/wavesurfer.esm.vI8Eid4k.js +73 -0
  208. streamlit/static/static/js/withFullScreenWrapper.zothJIsI.js +1 -0
  209. streamlit/static/static/media/MaterialSymbols-Rounded.C7IFxh57.woff2 +0 -0
  210. streamlit/string_util.py +56 -1
  211. streamlit/testing/v1/app_test.py +2 -2
  212. streamlit/testing/v1/element_tree.py +23 -9
  213. streamlit/testing/v1/util.py +2 -2
  214. streamlit/type_util.py +3 -4
  215. streamlit/url_util.py +1 -3
  216. streamlit/user_info.py +1 -2
  217. streamlit/util.py +3 -1
  218. streamlit/watcher/event_based_path_watcher.py +23 -12
  219. streamlit/watcher/local_sources_watcher.py +11 -1
  220. streamlit/watcher/path_watcher.py +9 -6
  221. streamlit/watcher/polling_path_watcher.py +4 -1
  222. streamlit/watcher/util.py +2 -2
  223. streamlit/web/bootstrap.py +0 -31
  224. streamlit/web/cli.py +51 -22
  225. streamlit/web/server/bidi_component_request_handler.py +193 -0
  226. streamlit/web/server/component_file_utils.py +97 -0
  227. streamlit/web/server/component_request_handler.py +8 -21
  228. streamlit/web/server/oidc_mixin.py +3 -1
  229. streamlit/web/server/routes.py +18 -5
  230. streamlit/web/server/server.py +10 -0
  231. streamlit/web/server/server_util.py +3 -1
  232. streamlit/web/server/upload_file_request_handler.py +3 -1
  233. {streamlit-1.49.1.dist-info → streamlit-1.51.0.dist-info}/METADATA +4 -5
  234. {streamlit-1.49.1.dist-info → streamlit-1.51.0.dist-info}/RECORD +238 -209
  235. streamlit/static/static/css/index.COe1010n.css +0 -1
  236. streamlit/static/static/js/Hooks.DGu1od_L.js +0 -1
  237. streamlit/static/static/js/InputInstructions.z6sVgyYt.js +0 -1
  238. streamlit/static/static/js/Toolbar.DSnK1fUh.js +0 -1
  239. streamlit/static/static/js/data-grid-overlay-editor.DRTHOydk.js +0 -1
  240. streamlit/static/static/js/index.BXYmrqnf.js +0 -1
  241. streamlit/static/static/js/index.B_8AnktO.js +0 -1
  242. streamlit/static/static/js/index.Bl7zGQSh.js +0 -7
  243. streamlit/static/static/js/index.BnJIOYn9.js +0 -73
  244. streamlit/static/static/js/index.C1HcTl5K.js +0 -1
  245. streamlit/static/static/js/index.C7lSmSOP.js +0 -1
  246. streamlit/static/static/js/index.C_tmcx4B.js +0 -1
  247. streamlit/static/static/js/index.D3K5nOu9.js +0 -197
  248. streamlit/static/static/js/index.DkKT3LUI.js +0 -1
  249. streamlit/static/static/js/index.MTPPBDHk.js +0 -2
  250. streamlit/static/static/js/index.pqW9AMJD.js +0 -3
  251. streamlit/static/static/js/index.urHgTgMQ.js +0 -12
  252. streamlit/static/static/js/index.wzkv_11M.js +0 -1
  253. streamlit/static/static/js/index.yF5AncHY.js +0 -1
  254. streamlit/static/static/js/withFullScreenWrapper.DLp1ENGm.js +0 -1
  255. streamlit/static/static/media/MaterialSymbols-Rounded.CBxVaFdk.woff2 +0 -0
  256. {streamlit-1.49.1.data → streamlit-1.51.0.data}/scripts/streamlit.cmd +0 -0
  257. {streamlit-1.49.1.dist-info → streamlit-1.51.0.dist-info}/WHEEL +0 -0
  258. {streamlit-1.49.1.dist-info → streamlit-1.51.0.dist-info}/entry_points.txt +0 -0
  259. {streamlit-1.49.1.dist-info → streamlit-1.51.0.dist-info}/top_level.txt +0 -0
streamlit/config.py CHANGED
@@ -24,13 +24,16 @@ import secrets
24
24
  import threading
25
25
  from collections import OrderedDict
26
26
  from enum import Enum
27
- from typing import Any, Callable, Final, Literal
27
+ from typing import TYPE_CHECKING, Any, Final, Literal
28
28
 
29
29
  from blinker import Signal
30
30
 
31
31
  from streamlit import config_util, development, env_util, file_util, util
32
32
  from streamlit.config_option import ConfigOption
33
- from streamlit.errors import StreamlitAPIException
33
+ from streamlit.errors import StreamlitAPIException, StreamlitInvalidThemeSectionError
34
+
35
+ if TYPE_CHECKING:
36
+ from collections.abc import Callable
34
37
 
35
38
  # Config System Global State #
36
39
 
@@ -98,6 +101,10 @@ class CustomThemeCategories(str, Enum):
98
101
  """Theme categories that can be set with custom theme config."""
99
102
 
100
103
  SIDEBAR = "sidebar"
104
+ LIGHT = "light"
105
+ DARK = "dark"
106
+ LIGHT_SIDEBAR = "light.sidebar"
107
+ DARK_SIDEBAR = "dark.sidebar"
101
108
 
102
109
 
103
110
  def set_option(key: str, value: Any, where_defined: str = _USER_DEFINED) -> None:
@@ -323,6 +330,8 @@ def _create_theme_options(
323
330
  The same config option can be supported for multiple categories, e.g. "theme"
324
331
  and "theme.sidebar".
325
332
  """
333
+ # Handle creation of the main theme config sections (e.g. theme, theme.sidebar, theme.light, theme.dark)
334
+ # as well as the nested subsections (e.g. theme.light.sidebar, theme.dark.sidebar)
326
335
  for cat in categories:
327
336
  section = cat if cat == "theme" else f"theme.{cat.value}"
328
337
 
@@ -1045,8 +1054,8 @@ def _browser_server_port() -> int:
1045
1054
 
1046
1055
  _SSL_PRODUCTION_WARNING = [
1047
1056
  "DO NOT USE THIS OPTION IN A PRODUCTION ENVIRONMENT. It has not gone through "
1048
- "security audits or performance tests. For the production environment, "
1049
- "we recommend performing SSL termination by the load balancer or the reverse proxy."
1057
+ "security audits or performance tests. For a production environment, we "
1058
+ "recommend performing SSL termination through a load balancer or reverse proxy."
1050
1059
  ]
1051
1060
 
1052
1061
  _create_option(
@@ -1148,24 +1157,66 @@ _create_section("theme", "Settings to define a custom theme for your Streamlit a
1148
1157
 
1149
1158
  # Create a section for each custom theme element
1150
1159
  for cat in list(CustomThemeCategories):
1151
- _create_section(
1152
- f"theme.{cat.value}",
1153
- f"Settings to define a custom {cat.value} theme in your Streamlit app.",
1154
- )
1160
+ if cat == CustomThemeCategories.SIDEBAR:
1161
+ _create_section(
1162
+ f"theme.{cat.value}",
1163
+ f"Settings to define a custom {cat.value} theme in your Streamlit app.",
1164
+ )
1165
+ elif cat == CustomThemeCategories.LIGHT:
1166
+ _create_section(
1167
+ f"theme.{cat.value}",
1168
+ "Settings to define custom light theme properties that extend the defined [theme] properties.",
1169
+ )
1170
+ elif cat == CustomThemeCategories.DARK:
1171
+ _create_section(
1172
+ f"theme.{cat.value}",
1173
+ "Settings to define custom dark theme properties that extend the defined [theme] properties.",
1174
+ )
1175
+
1176
+ # Create nested sidebar sections
1177
+ elif cat == CustomThemeCategories.LIGHT_SIDEBAR:
1178
+ _create_section(
1179
+ f"theme.{cat.value}",
1180
+ """Settings to define custom light theme properties for the sidebar that extend the defined
1181
+ [theme.sidebar] properties.""",
1182
+ )
1183
+ elif cat == CustomThemeCategories.DARK_SIDEBAR:
1184
+ _create_section(
1185
+ f"theme.{cat.value}",
1186
+ """Settings to define custom dark theme properties for the sidebar that extend the defined
1187
+ [theme.sidebar] properties.""",
1188
+ )
1155
1189
 
1156
1190
  _create_theme_options(
1157
1191
  "base",
1158
1192
  categories=["theme"],
1159
1193
  description="""
1160
- The preset Streamlit theme that your custom theme inherits from.
1194
+ The theme that your custom theme inherits from.
1195
+
1196
+ This can be one of the following:
1197
+ - "light": Streamlit's default light theme.
1198
+ - "dark": Streamlit's default dark theme.
1199
+ - A local file path to a TOML theme file: A local custom theme, like
1200
+ "themes/custom.toml".
1201
+ - A URL to a TOML theme file: An externally hosted custom theme, like
1202
+ "https://example.com/theme.toml".
1161
1203
 
1162
- This can be one of the following: "light" or "dark".
1204
+ A TOML theme file must contain a [theme] table with theme options.
1205
+ Any theme options defined in the app's config.toml file will override
1206
+ those defined in the TOML theme file.
1163
1207
  """,
1164
1208
  )
1165
1209
 
1166
1210
  _create_theme_options(
1167
1211
  "primaryColor",
1168
- categories=["theme", CustomThemeCategories.SIDEBAR],
1212
+ categories=[
1213
+ "theme",
1214
+ CustomThemeCategories.SIDEBAR,
1215
+ CustomThemeCategories.LIGHT,
1216
+ CustomThemeCategories.DARK,
1217
+ CustomThemeCategories.LIGHT_SIDEBAR,
1218
+ CustomThemeCategories.DARK_SIDEBAR,
1219
+ ],
1169
1220
  description="""
1170
1221
  Primary accent color.
1171
1222
  """,
@@ -1173,7 +1224,14 @@ _create_theme_options(
1173
1224
 
1174
1225
  _create_theme_options(
1175
1226
  "backgroundColor",
1176
- categories=["theme", CustomThemeCategories.SIDEBAR],
1227
+ categories=[
1228
+ "theme",
1229
+ CustomThemeCategories.SIDEBAR,
1230
+ CustomThemeCategories.LIGHT,
1231
+ CustomThemeCategories.DARK,
1232
+ CustomThemeCategories.LIGHT_SIDEBAR,
1233
+ CustomThemeCategories.DARK_SIDEBAR,
1234
+ ],
1177
1235
  description="""
1178
1236
  Background color of the app.
1179
1237
  """,
@@ -1181,7 +1239,14 @@ _create_theme_options(
1181
1239
 
1182
1240
  _create_theme_options(
1183
1241
  "secondaryBackgroundColor",
1184
- categories=["theme", CustomThemeCategories.SIDEBAR],
1242
+ categories=[
1243
+ "theme",
1244
+ CustomThemeCategories.SIDEBAR,
1245
+ CustomThemeCategories.LIGHT,
1246
+ CustomThemeCategories.DARK,
1247
+ CustomThemeCategories.LIGHT_SIDEBAR,
1248
+ CustomThemeCategories.DARK_SIDEBAR,
1249
+ ],
1185
1250
  description="""
1186
1251
  Background color used for most interactive widgets.
1187
1252
  """,
@@ -1189,32 +1254,526 @@ _create_theme_options(
1189
1254
 
1190
1255
  _create_theme_options(
1191
1256
  "textColor",
1192
- categories=["theme", CustomThemeCategories.SIDEBAR],
1257
+ categories=[
1258
+ "theme",
1259
+ CustomThemeCategories.SIDEBAR,
1260
+ CustomThemeCategories.LIGHT,
1261
+ CustomThemeCategories.DARK,
1262
+ CustomThemeCategories.LIGHT_SIDEBAR,
1263
+ CustomThemeCategories.DARK_SIDEBAR,
1264
+ ],
1193
1265
  description="""
1194
1266
  Color used for almost all text.
1195
1267
  """,
1196
1268
  )
1197
1269
 
1270
+ _create_theme_options(
1271
+ "redColor",
1272
+ categories=[
1273
+ "theme",
1274
+ CustomThemeCategories.SIDEBAR,
1275
+ CustomThemeCategories.LIGHT,
1276
+ CustomThemeCategories.DARK,
1277
+ CustomThemeCategories.LIGHT_SIDEBAR,
1278
+ CustomThemeCategories.DARK_SIDEBAR,
1279
+ ],
1280
+ description="""
1281
+ Red color used in the basic color palette.
1282
+
1283
+ By default, this is #ff4b4b for the light theme and #ff2b2b for the
1284
+ dark theme.
1285
+
1286
+ If `redColor` is provided, and `redBackgroundColor` isn't, then
1287
+ `redBackgroundColor` will be derived from `redColor` using 10%
1288
+ opacity for the light theme and 20% opacity for the dark theme.
1289
+ """,
1290
+ )
1291
+
1292
+ _create_theme_options(
1293
+ "orangeColor",
1294
+ categories=[
1295
+ "theme",
1296
+ CustomThemeCategories.SIDEBAR,
1297
+ CustomThemeCategories.LIGHT,
1298
+ CustomThemeCategories.DARK,
1299
+ CustomThemeCategories.LIGHT_SIDEBAR,
1300
+ CustomThemeCategories.DARK_SIDEBAR,
1301
+ ],
1302
+ description="""
1303
+ Orange color used in the basic color palette.
1304
+
1305
+ By default, this is #ffa421 for the light theme and #ff8700 for the
1306
+ dark theme.
1307
+
1308
+ If `orangeColor` is provided, and `orangeBackgroundColor` isn't, then
1309
+ `orangeBackgroundColor` will be derived from `orangeColor` using 10%
1310
+ opacity for the light theme and 20% opacity for the dark theme.
1311
+ """,
1312
+ )
1313
+
1314
+ _create_theme_options(
1315
+ "yellowColor",
1316
+ categories=[
1317
+ "theme",
1318
+ CustomThemeCategories.SIDEBAR,
1319
+ CustomThemeCategories.LIGHT,
1320
+ CustomThemeCategories.DARK,
1321
+ CustomThemeCategories.LIGHT_SIDEBAR,
1322
+ CustomThemeCategories.DARK_SIDEBAR,
1323
+ ],
1324
+ description="""
1325
+ Yellow color used in the basic color palette.
1326
+
1327
+ By default, this is #faca2b for the light theme and #ffe312 for the
1328
+ dark theme.
1329
+
1330
+ If `yellowColor` is provided, and `yellowBackgroundColor` isn't, then
1331
+ `yellowBackgroundColor` will be derived from `yellowColor` using 10%
1332
+ opacity for the light theme and 20% opacity for the dark theme.
1333
+ """,
1334
+ )
1335
+
1336
+ _create_theme_options(
1337
+ "blueColor",
1338
+ categories=[
1339
+ "theme",
1340
+ CustomThemeCategories.SIDEBAR,
1341
+ CustomThemeCategories.LIGHT,
1342
+ CustomThemeCategories.DARK,
1343
+ CustomThemeCategories.LIGHT_SIDEBAR,
1344
+ CustomThemeCategories.DARK_SIDEBAR,
1345
+ ],
1346
+ description="""
1347
+ Blue color used in the basic color palette.
1348
+
1349
+ By default, this is #1c83e1 for the light theme and #0068c9 for the
1350
+ dark theme.
1351
+
1352
+ If a `blueColor` is provided, and `blueBackgroundColor` isn't, then
1353
+ `blueBackgroundColor` will be derived from `blueColor` using 10%
1354
+ opacity for the light theme and 20% opacity for the dark theme.
1355
+ """,
1356
+ )
1357
+
1358
+ _create_theme_options(
1359
+ "greenColor",
1360
+ categories=[
1361
+ "theme",
1362
+ CustomThemeCategories.SIDEBAR,
1363
+ CustomThemeCategories.LIGHT,
1364
+ CustomThemeCategories.DARK,
1365
+ CustomThemeCategories.LIGHT_SIDEBAR,
1366
+ CustomThemeCategories.DARK_SIDEBAR,
1367
+ ],
1368
+ description="""
1369
+ Green color used in the basic color palette.
1370
+
1371
+ By default, this is #21c354 for the light theme and #09ab3b for the
1372
+ dark theme.
1373
+
1374
+ If `greenColor` is provided, and `greenBackgroundColor` isn't, then
1375
+ `greenBackgroundColor` will be derived from `greenColor` using 10%
1376
+ opacity for the light theme and 20% opacity for the dark theme.
1377
+ """,
1378
+ )
1379
+
1380
+ _create_theme_options(
1381
+ "violetColor",
1382
+ categories=[
1383
+ "theme",
1384
+ CustomThemeCategories.SIDEBAR,
1385
+ CustomThemeCategories.LIGHT,
1386
+ CustomThemeCategories.DARK,
1387
+ CustomThemeCategories.LIGHT_SIDEBAR,
1388
+ CustomThemeCategories.DARK_SIDEBAR,
1389
+ ],
1390
+ description="""
1391
+ Violet color used in the basic color palette.
1392
+
1393
+ By default, this is #803df5 for both the light and dark themes.
1394
+
1395
+ If a `violetColor` is provided, and `violetBackgroundColor` isn't, then
1396
+ `violetBackgroundColor` will be derived from `violetColor` using 10%
1397
+ opacity for the light theme and 20% opacity for the dark theme.
1398
+ """,
1399
+ )
1400
+
1401
+ _create_theme_options(
1402
+ "grayColor",
1403
+ categories=[
1404
+ "theme",
1405
+ CustomThemeCategories.SIDEBAR,
1406
+ CustomThemeCategories.LIGHT,
1407
+ CustomThemeCategories.DARK,
1408
+ CustomThemeCategories.LIGHT_SIDEBAR,
1409
+ CustomThemeCategories.DARK_SIDEBAR,
1410
+ ],
1411
+ description="""
1412
+ Gray color used in the basic color palette.
1413
+
1414
+ By default, this is #a3a8b8 for the light theme and #555867 for the
1415
+ dark theme.
1416
+
1417
+ If `grayColor` is provided, and `grayBackgroundColor` isn't, then
1418
+ `grayBackgroundColor` will be derived from `grayColor` using 10%
1419
+ opacity for the light theme and 20% opacity for the dark theme.
1420
+ """,
1421
+ )
1422
+
1423
+ _create_theme_options(
1424
+ "redBackgroundColor",
1425
+ categories=[
1426
+ "theme",
1427
+ CustomThemeCategories.SIDEBAR,
1428
+ CustomThemeCategories.LIGHT,
1429
+ CustomThemeCategories.DARK,
1430
+ CustomThemeCategories.LIGHT_SIDEBAR,
1431
+ CustomThemeCategories.DARK_SIDEBAR,
1432
+ ],
1433
+ description="""
1434
+ Red background color used in the basic color palette.
1435
+
1436
+ If `redColor` is provided, this defaults to `redColor` using 10%
1437
+ opacity for the light theme and 20% opacity for the dark theme.
1438
+
1439
+ Otherwise, this is #ff2b2b with 10% opacity for light theme and
1440
+ #ff6c6c with 20% opacity for dark theme.
1441
+ """,
1442
+ )
1443
+
1444
+ _create_theme_options(
1445
+ "orangeBackgroundColor",
1446
+ categories=[
1447
+ "theme",
1448
+ CustomThemeCategories.SIDEBAR,
1449
+ CustomThemeCategories.LIGHT,
1450
+ CustomThemeCategories.DARK,
1451
+ CustomThemeCategories.LIGHT_SIDEBAR,
1452
+ CustomThemeCategories.DARK_SIDEBAR,
1453
+ ],
1454
+ description="""
1455
+ Orange background color used for the basic color palette.
1456
+
1457
+ If `orangeColor` is provided, this defaults to `orangeColor` using 10%
1458
+ opacity for the light theme and 20% opacity for the dark theme.
1459
+
1460
+ Otherwise, this is #ffa421 with 10% opacity for the light theme and
1461
+ #ff8700 with 20% opacity for the dark theme.
1462
+ """,
1463
+ )
1464
+
1465
+ _create_theme_options(
1466
+ "yellowBackgroundColor",
1467
+ categories=[
1468
+ "theme",
1469
+ CustomThemeCategories.SIDEBAR,
1470
+ CustomThemeCategories.LIGHT,
1471
+ CustomThemeCategories.DARK,
1472
+ CustomThemeCategories.LIGHT_SIDEBAR,
1473
+ CustomThemeCategories.DARK_SIDEBAR,
1474
+ ],
1475
+ description="""
1476
+ Yellow background color used for the basic color palette.
1477
+
1478
+ If `yellowColor` is provided, this defaults to `yellowColor` using 10%
1479
+ opacity for the light theme and 20% opacity for the dark theme.
1480
+
1481
+ Otherwise, this is #ffff12 with 10% opacity for the light theme and
1482
+ #ffff12 with 20% opacity for the dark theme.
1483
+ """,
1484
+ )
1485
+
1486
+ _create_theme_options(
1487
+ "blueBackgroundColor",
1488
+ categories=[
1489
+ "theme",
1490
+ CustomThemeCategories.SIDEBAR,
1491
+ CustomThemeCategories.LIGHT,
1492
+ CustomThemeCategories.DARK,
1493
+ CustomThemeCategories.LIGHT_SIDEBAR,
1494
+ CustomThemeCategories.DARK_SIDEBAR,
1495
+ ],
1496
+ description="""
1497
+ Blue background color used for the basic color palette.
1498
+
1499
+ If `blueColor` is provided, this defaults to `blueColor` using 10%
1500
+ opacity for the light theme and 20% opacity for the dark theme.
1501
+
1502
+ Otherwise, this is #1c83ff with 10% opacity for the light theme and
1503
+ #3d9df3 with 20% opacity for the dark theme.
1504
+ """,
1505
+ )
1506
+
1507
+ _create_theme_options(
1508
+ "greenBackgroundColor",
1509
+ categories=[
1510
+ "theme",
1511
+ CustomThemeCategories.SIDEBAR,
1512
+ CustomThemeCategories.LIGHT,
1513
+ CustomThemeCategories.DARK,
1514
+ CustomThemeCategories.LIGHT_SIDEBAR,
1515
+ CustomThemeCategories.DARK_SIDEBAR,
1516
+ ],
1517
+ description="""
1518
+ Green background color used for the basic color palette.
1519
+
1520
+ If `greenColor` is provided, this defaults to `greenColor` using 10%
1521
+ opacity for the light theme and 20% opacity for the dark theme.
1522
+
1523
+ Otherwise, this is #21c354 with 10% opacity for the light theme and
1524
+ #3dd56d with 20% opacity for the dark theme.
1525
+ """,
1526
+ )
1527
+
1528
+ _create_theme_options(
1529
+ "violetBackgroundColor",
1530
+ categories=[
1531
+ "theme",
1532
+ CustomThemeCategories.SIDEBAR,
1533
+ CustomThemeCategories.LIGHT,
1534
+ CustomThemeCategories.DARK,
1535
+ CustomThemeCategories.LIGHT_SIDEBAR,
1536
+ CustomThemeCategories.DARK_SIDEBAR,
1537
+ ],
1538
+ description="""
1539
+ Violet background color used for the basic color palette.
1540
+
1541
+ If `violetColor` is provided, this defaults to `violetColor` using 10%
1542
+ opacity for the light theme and 20% opacity for the dark theme.
1543
+
1544
+ Otherwise, this is #9a5dff with 10% opacity for light theme and
1545
+ #9a5dff with 20% opacity for dark theme.
1546
+ """,
1547
+ )
1548
+
1549
+ _create_theme_options(
1550
+ "grayBackgroundColor",
1551
+ categories=[
1552
+ "theme",
1553
+ CustomThemeCategories.SIDEBAR,
1554
+ CustomThemeCategories.LIGHT,
1555
+ CustomThemeCategories.DARK,
1556
+ CustomThemeCategories.LIGHT_SIDEBAR,
1557
+ CustomThemeCategories.DARK_SIDEBAR,
1558
+ ],
1559
+ description="""
1560
+ Gray background color used for the basic color palette.
1561
+
1562
+ If `grayColor` is provided, this defaults to `grayColor` using 10%
1563
+ opacity for the light theme and 20% opacity for the dark theme.
1564
+
1565
+ Otherwise, this is #31333f with 10% opacity for the light theme and
1566
+ #808495 with 20% opacity for the dark theme.
1567
+ """,
1568
+ )
1569
+
1570
+ _create_theme_options(
1571
+ "redTextColor",
1572
+ categories=[
1573
+ "theme",
1574
+ CustomThemeCategories.SIDEBAR,
1575
+ CustomThemeCategories.LIGHT,
1576
+ CustomThemeCategories.DARK,
1577
+ CustomThemeCategories.LIGHT_SIDEBAR,
1578
+ CustomThemeCategories.DARK_SIDEBAR,
1579
+ ],
1580
+ description="""
1581
+ Red text color used for the basic color palette.
1582
+
1583
+ If `redColor` is provided, this defaults to `redColor`, darkened by 15%
1584
+ for the light theme and lightened by 15% for the dark theme.
1585
+
1586
+ Otherwise, this is #bd4043 for the light theme and #ff6c6c for the dark
1587
+ theme.
1588
+ """,
1589
+ )
1590
+
1591
+ _create_theme_options(
1592
+ "orangeTextColor",
1593
+ categories=[
1594
+ "theme",
1595
+ CustomThemeCategories.SIDEBAR,
1596
+ CustomThemeCategories.LIGHT,
1597
+ CustomThemeCategories.DARK,
1598
+ CustomThemeCategories.LIGHT_SIDEBAR,
1599
+ CustomThemeCategories.DARK_SIDEBAR,
1600
+ ],
1601
+ description="""
1602
+ Orange text color used for the basic color palette.
1603
+
1604
+ If `orangeColor` is provided, this defaults to `orangeColor`, darkened
1605
+ by 15% for the light theme and lightened by 15% for the dark theme.
1606
+
1607
+ Otherwise, this is #e2660c for the light theme and #ffbd45 for the dark
1608
+ theme.
1609
+ """,
1610
+ )
1611
+
1612
+ _create_theme_options(
1613
+ "yellowTextColor",
1614
+ categories=[
1615
+ "theme",
1616
+ CustomThemeCategories.SIDEBAR,
1617
+ CustomThemeCategories.LIGHT,
1618
+ CustomThemeCategories.DARK,
1619
+ CustomThemeCategories.LIGHT_SIDEBAR,
1620
+ CustomThemeCategories.DARK_SIDEBAR,
1621
+ ],
1622
+ description="""
1623
+ Yellow text color used for the basic color palette.
1624
+
1625
+ If `yellowColor` is provided, this defaults to `yellowColor`, darkened
1626
+ by 15% for the light theme and lightened by 15% for the dark theme.
1627
+
1628
+ Otherwise, this is #926c05 for the light theme and #ffffc2 for the dark
1629
+ theme.
1630
+ """,
1631
+ )
1632
+
1633
+ _create_theme_options(
1634
+ "blueTextColor",
1635
+ categories=[
1636
+ "theme",
1637
+ CustomThemeCategories.SIDEBAR,
1638
+ CustomThemeCategories.LIGHT,
1639
+ CustomThemeCategories.DARK,
1640
+ CustomThemeCategories.LIGHT_SIDEBAR,
1641
+ CustomThemeCategories.DARK_SIDEBAR,
1642
+ ],
1643
+ description="""
1644
+ Blue text color used for the basic color palette.
1645
+
1646
+ If `blueColor` is provided, this defaults to `blueColor`, darkened by
1647
+ 15% for the light theme and lightened by 15% for the dark theme.
1648
+
1649
+ Otherwise, this is #0054a3 for the light theme and #3d9df3 for the dark
1650
+ theme.
1651
+ """,
1652
+ )
1653
+
1654
+ _create_theme_options(
1655
+ "greenTextColor",
1656
+ categories=[
1657
+ "theme",
1658
+ CustomThemeCategories.SIDEBAR,
1659
+ CustomThemeCategories.LIGHT,
1660
+ CustomThemeCategories.DARK,
1661
+ CustomThemeCategories.LIGHT_SIDEBAR,
1662
+ CustomThemeCategories.DARK_SIDEBAR,
1663
+ ],
1664
+ description="""
1665
+ Green text color used for the basic color palette.
1666
+
1667
+ If `greenColor` is provided, this defaults to `greenColor`, darkened by
1668
+ 15% for the light theme and lightened by 15% for the dark theme.
1669
+
1670
+ Otherwise, this is #158237 for the light theme and #5ce488 for the dark
1671
+ theme.
1672
+ """,
1673
+ )
1674
+
1675
+ _create_theme_options(
1676
+ "violetTextColor",
1677
+ categories=[
1678
+ "theme",
1679
+ CustomThemeCategories.SIDEBAR,
1680
+ CustomThemeCategories.LIGHT,
1681
+ CustomThemeCategories.DARK,
1682
+ CustomThemeCategories.LIGHT_SIDEBAR,
1683
+ CustomThemeCategories.DARK_SIDEBAR,
1684
+ ],
1685
+ description="""
1686
+ Violet text color used for the basic color palette.
1687
+
1688
+ If `violetColor` is provided, this defaults to `violetColor`, darkened
1689
+ by 15% for the light theme and lightened by 15% for the dark theme.
1690
+
1691
+ Otherwise, this is #583f84 for the light theme and #b27eff for the dark
1692
+ theme.
1693
+ """,
1694
+ )
1695
+
1696
+ _create_theme_options(
1697
+ "grayTextColor",
1698
+ categories=[
1699
+ "theme",
1700
+ CustomThemeCategories.SIDEBAR,
1701
+ CustomThemeCategories.LIGHT,
1702
+ CustomThemeCategories.DARK,
1703
+ CustomThemeCategories.LIGHT_SIDEBAR,
1704
+ CustomThemeCategories.DARK_SIDEBAR,
1705
+ ],
1706
+ description="""
1707
+ Gray text color used for the basic color palette.
1708
+
1709
+ If `grayColor` is provided, this defaults to `grayColor`, darkened by
1710
+ 15% for the light theme and lightened by 15% for the dark theme.
1711
+
1712
+ Otherwise, this is #31333f with 60% opacity for the light theme and
1713
+ #fafafa with 60% opacity for the dark theme.
1714
+ """,
1715
+ )
1716
+
1198
1717
  _create_theme_options(
1199
1718
  "linkColor",
1200
- categories=["theme", CustomThemeCategories.SIDEBAR],
1719
+ categories=[
1720
+ "theme",
1721
+ CustomThemeCategories.SIDEBAR,
1722
+ CustomThemeCategories.LIGHT,
1723
+ CustomThemeCategories.DARK,
1724
+ CustomThemeCategories.LIGHT_SIDEBAR,
1725
+ CustomThemeCategories.DARK_SIDEBAR,
1726
+ ],
1201
1727
  description="""
1202
1728
  Color used for all links.
1729
+
1730
+ This defaults to the resolved value of `blueTextColor`.
1203
1731
  """,
1204
1732
  )
1205
1733
 
1206
1734
  _create_theme_options(
1207
1735
  "linkUnderline",
1208
- categories=["theme", CustomThemeCategories.SIDEBAR],
1736
+ categories=[
1737
+ "theme",
1738
+ CustomThemeCategories.SIDEBAR,
1739
+ CustomThemeCategories.LIGHT,
1740
+ CustomThemeCategories.DARK,
1741
+ CustomThemeCategories.LIGHT_SIDEBAR,
1742
+ CustomThemeCategories.DARK_SIDEBAR,
1743
+ ],
1209
1744
  description="""
1210
1745
  Whether or not links should be displayed with an underline.
1211
1746
  """,
1212
1747
  type_=bool,
1213
1748
  )
1214
1749
 
1750
+ _create_theme_options(
1751
+ "codeTextColor",
1752
+ categories=[
1753
+ "theme",
1754
+ CustomThemeCategories.SIDEBAR,
1755
+ CustomThemeCategories.LIGHT,
1756
+ CustomThemeCategories.DARK,
1757
+ CustomThemeCategories.LIGHT_SIDEBAR,
1758
+ CustomThemeCategories.DARK_SIDEBAR,
1759
+ ],
1760
+ description="""
1761
+ Text color used for code blocks.
1762
+
1763
+ This defaults to the resolved value of `greenTextColor`.
1764
+ """,
1765
+ )
1766
+
1215
1767
  _create_theme_options(
1216
1768
  "codeBackgroundColor",
1217
- categories=["theme", CustomThemeCategories.SIDEBAR],
1769
+ categories=[
1770
+ "theme",
1771
+ CustomThemeCategories.SIDEBAR,
1772
+ CustomThemeCategories.LIGHT,
1773
+ CustomThemeCategories.DARK,
1774
+ CustomThemeCategories.LIGHT_SIDEBAR,
1775
+ CustomThemeCategories.DARK_SIDEBAR,
1776
+ ],
1218
1777
  description="""
1219
1778
  Background color used for code blocks.
1220
1779
  """,
@@ -1222,7 +1781,14 @@ _create_theme_options(
1222
1781
 
1223
1782
  _create_theme_options(
1224
1783
  "font",
1225
- categories=["theme", CustomThemeCategories.SIDEBAR],
1784
+ categories=[
1785
+ "theme",
1786
+ CustomThemeCategories.SIDEBAR,
1787
+ CustomThemeCategories.LIGHT,
1788
+ CustomThemeCategories.DARK,
1789
+ CustomThemeCategories.LIGHT_SIDEBAR,
1790
+ CustomThemeCategories.DARK_SIDEBAR,
1791
+ ],
1226
1792
  description="""
1227
1793
  The font family for all text, except code blocks.
1228
1794
 
@@ -1231,6 +1797,8 @@ _create_theme_options(
1231
1797
  - "serif"
1232
1798
  - "monospace"
1233
1799
  - The `family` value for a custom font table under [[theme.fontFaces]]
1800
+ - A URL to a CSS file in the format of "<font name>:<url>" (like
1801
+ "Nunito:https://fonts.googleapis.com/css2?family=Nunito&display=swap")
1234
1802
  - A comma-separated list of these (as a single string) to specify
1235
1803
  fallbacks
1236
1804
 
@@ -1301,7 +1869,14 @@ _create_theme_options(
1301
1869
 
1302
1870
  _create_theme_options(
1303
1871
  "headingFont",
1304
- categories=["theme", CustomThemeCategories.SIDEBAR],
1872
+ categories=[
1873
+ "theme",
1874
+ CustomThemeCategories.SIDEBAR,
1875
+ CustomThemeCategories.LIGHT,
1876
+ CustomThemeCategories.DARK,
1877
+ CustomThemeCategories.LIGHT_SIDEBAR,
1878
+ CustomThemeCategories.DARK_SIDEBAR,
1879
+ ],
1305
1880
  description="""
1306
1881
  The font family to use for headings.
1307
1882
 
@@ -1310,6 +1885,8 @@ _create_theme_options(
1310
1885
  - "serif"
1311
1886
  - "monospace"
1312
1887
  - The `family` value for a custom font table under [[theme.fontFaces]]
1888
+ - A URL to a CSS file in the format of "<font name>:<url>" (like
1889
+ "Nunito:https://fonts.googleapis.com/css2?family=Nunito&display=swap")
1313
1890
  - A comma-separated list of these (as a single string) to specify
1314
1891
  fallbacks
1315
1892
 
@@ -1319,7 +1896,14 @@ _create_theme_options(
1319
1896
 
1320
1897
  _create_theme_options(
1321
1898
  "headingFontSizes",
1322
- categories=["theme", CustomThemeCategories.SIDEBAR],
1899
+ categories=[
1900
+ "theme",
1901
+ CustomThemeCategories.SIDEBAR,
1902
+ CustomThemeCategories.LIGHT,
1903
+ CustomThemeCategories.DARK,
1904
+ CustomThemeCategories.LIGHT_SIDEBAR,
1905
+ CustomThemeCategories.DARK_SIDEBAR,
1906
+ ],
1323
1907
  description="""
1324
1908
  One or more font sizes for h1-h6 headings.
1325
1909
 
@@ -1351,7 +1935,14 @@ _create_theme_options(
1351
1935
 
1352
1936
  _create_theme_options(
1353
1937
  "headingFontWeights",
1354
- categories=["theme", CustomThemeCategories.SIDEBAR],
1938
+ categories=[
1939
+ "theme",
1940
+ CustomThemeCategories.SIDEBAR,
1941
+ CustomThemeCategories.LIGHT,
1942
+ CustomThemeCategories.DARK,
1943
+ CustomThemeCategories.LIGHT_SIDEBAR,
1944
+ CustomThemeCategories.DARK_SIDEBAR,
1945
+ ],
1355
1946
  description="""
1356
1947
  One or more font weights for h1-h6 headings.
1357
1948
 
@@ -1381,7 +1972,14 @@ _create_theme_options(
1381
1972
 
1382
1973
  _create_theme_options(
1383
1974
  "codeFont",
1384
- categories=["theme", CustomThemeCategories.SIDEBAR],
1975
+ categories=[
1976
+ "theme",
1977
+ CustomThemeCategories.SIDEBAR,
1978
+ CustomThemeCategories.LIGHT,
1979
+ CustomThemeCategories.DARK,
1980
+ CustomThemeCategories.LIGHT_SIDEBAR,
1981
+ CustomThemeCategories.DARK_SIDEBAR,
1982
+ ],
1385
1983
  description="""
1386
1984
  The font family to use for code (monospace) in the sidebar.
1387
1985
 
@@ -1390,6 +1988,8 @@ _create_theme_options(
1390
1988
  - "serif"
1391
1989
  - "monospace"
1392
1990
  - The `family` value for a custom font table under [[theme.fontFaces]]
1991
+ - A URL to a CSS file in the format of "<font name>:<url>" (like
1992
+ "'Space Mono':https://fonts.googleapis.com/css2?family=Space+Mono&display=swap")
1393
1993
  - A comma-separated list of these (as a single string) to specify
1394
1994
  fallbacks
1395
1995
  """,
@@ -1397,7 +1997,14 @@ _create_theme_options(
1397
1997
 
1398
1998
  _create_theme_options(
1399
1999
  "codeFontSize",
1400
- categories=["theme", CustomThemeCategories.SIDEBAR],
2000
+ categories=[
2001
+ "theme",
2002
+ CustomThemeCategories.SIDEBAR,
2003
+ CustomThemeCategories.LIGHT,
2004
+ CustomThemeCategories.DARK,
2005
+ CustomThemeCategories.LIGHT_SIDEBAR,
2006
+ CustomThemeCategories.DARK_SIDEBAR,
2007
+ ],
1401
2008
  description="""
1402
2009
  The font size (in pixels or rem) for code blocks and code text.
1403
2010
 
@@ -1410,7 +2017,14 @@ _create_theme_options(
1410
2017
 
1411
2018
  _create_theme_options(
1412
2019
  "codeFontWeight",
1413
- categories=["theme", CustomThemeCategories.SIDEBAR],
2020
+ categories=[
2021
+ "theme",
2022
+ CustomThemeCategories.SIDEBAR,
2023
+ CustomThemeCategories.LIGHT,
2024
+ CustomThemeCategories.DARK,
2025
+ CustomThemeCategories.LIGHT_SIDEBAR,
2026
+ CustomThemeCategories.DARK_SIDEBAR,
2027
+ ],
1414
2028
  description="""
1415
2029
  The font weight for code blocks and code text.
1416
2030
 
@@ -1425,7 +2039,14 @@ _create_theme_options(
1425
2039
 
1426
2040
  _create_theme_options(
1427
2041
  "baseRadius",
1428
- categories=["theme", CustomThemeCategories.SIDEBAR],
2042
+ categories=[
2043
+ "theme",
2044
+ CustomThemeCategories.SIDEBAR,
2045
+ CustomThemeCategories.LIGHT,
2046
+ CustomThemeCategories.DARK,
2047
+ CustomThemeCategories.LIGHT_SIDEBAR,
2048
+ CustomThemeCategories.DARK_SIDEBAR,
2049
+ ],
1429
2050
  description="""
1430
2051
  The radius used as basis for the corners of most UI elements.
1431
2052
 
@@ -1444,7 +2065,14 @@ _create_theme_options(
1444
2065
 
1445
2066
  _create_theme_options(
1446
2067
  "buttonRadius",
1447
- categories=["theme", CustomThemeCategories.SIDEBAR],
2068
+ categories=[
2069
+ "theme",
2070
+ CustomThemeCategories.SIDEBAR,
2071
+ CustomThemeCategories.LIGHT,
2072
+ CustomThemeCategories.DARK,
2073
+ CustomThemeCategories.LIGHT_SIDEBAR,
2074
+ CustomThemeCategories.DARK_SIDEBAR,
2075
+ ],
1448
2076
  description="""
1449
2077
  The radius used as basis for the corners of buttons.
1450
2078
 
@@ -1465,7 +2093,14 @@ _create_theme_options(
1465
2093
 
1466
2094
  _create_theme_options(
1467
2095
  "borderColor",
1468
- categories=["theme", CustomThemeCategories.SIDEBAR],
2096
+ categories=[
2097
+ "theme",
2098
+ CustomThemeCategories.SIDEBAR,
2099
+ CustomThemeCategories.LIGHT,
2100
+ CustomThemeCategories.DARK,
2101
+ CustomThemeCategories.LIGHT_SIDEBAR,
2102
+ CustomThemeCategories.DARK_SIDEBAR,
2103
+ ],
1469
2104
  description="""
1470
2105
  The color of the border around elements.
1471
2106
  """,
@@ -1473,7 +2108,14 @@ _create_theme_options(
1473
2108
 
1474
2109
  _create_theme_options(
1475
2110
  "dataframeBorderColor",
1476
- categories=["theme", CustomThemeCategories.SIDEBAR],
2111
+ categories=[
2112
+ "theme",
2113
+ CustomThemeCategories.SIDEBAR,
2114
+ CustomThemeCategories.LIGHT,
2115
+ CustomThemeCategories.DARK,
2116
+ CustomThemeCategories.LIGHT_SIDEBAR,
2117
+ CustomThemeCategories.DARK_SIDEBAR,
2118
+ ],
1477
2119
  description="""
1478
2120
  The color of the border around dataframes and tables.
1479
2121
 
@@ -1483,7 +2125,14 @@ _create_theme_options(
1483
2125
 
1484
2126
  _create_theme_options(
1485
2127
  "dataframeHeaderBackgroundColor",
1486
- categories=["theme", CustomThemeCategories.SIDEBAR],
2128
+ categories=[
2129
+ "theme",
2130
+ CustomThemeCategories.SIDEBAR,
2131
+ CustomThemeCategories.LIGHT,
2132
+ CustomThemeCategories.DARK,
2133
+ CustomThemeCategories.LIGHT_SIDEBAR,
2134
+ CustomThemeCategories.DARK_SIDEBAR,
2135
+ ],
1487
2136
  description="""
1488
2137
  The background color of the dataframe's header.
1489
2138
 
@@ -1497,7 +2146,14 @@ _create_theme_options(
1497
2146
 
1498
2147
  _create_theme_options(
1499
2148
  "showWidgetBorder",
1500
- categories=["theme", CustomThemeCategories.SIDEBAR],
2149
+ categories=[
2150
+ "theme",
2151
+ CustomThemeCategories.SIDEBAR,
2152
+ CustomThemeCategories.LIGHT,
2153
+ CustomThemeCategories.DARK,
2154
+ CustomThemeCategories.LIGHT_SIDEBAR,
2155
+ CustomThemeCategories.DARK_SIDEBAR,
2156
+ ],
1501
2157
  description="""
1502
2158
  Whether to show a border around input widgets.
1503
2159
  """,
@@ -1737,6 +2393,43 @@ def _update_config_with_sensitive_env_var(
1737
2393
  _set_option(opt_name, env_var_value, _DEFINED_BY_ENV_VAR)
1738
2394
 
1739
2395
 
2396
+ def _is_valid_theme_section(section_path: str) -> bool:
2397
+ """Check if a theme section path follows valid nesting rules, returns True if valid, False otherwise.
2398
+
2399
+ Valid patterns: theme.sidebar, theme.light, theme.dark, theme.light.sidebar, theme.dark.sidebar
2400
+ Invalid patterns: theme.sidebar.light, theme.sidebar.dark, theme.light.dark, theme.dark.light, etc.
2401
+
2402
+ Parameters
2403
+ ----------
2404
+ section_path : str
2405
+ The dot-separated theme section path (e.g., "theme.light.sidebar").
2406
+ Will always have at least 2 parts and start with "theme".
2407
+ """
2408
+ parts = section_path.split(".")
2409
+
2410
+ # theme.sidebar/light/dark is valid (2 parts: "theme" + section)
2411
+ if len(parts) == 2:
2412
+ return parts[1] in [
2413
+ CustomThemeCategories.SIDEBAR.value,
2414
+ CustomThemeCategories.LIGHT.value,
2415
+ CustomThemeCategories.DARK.value,
2416
+ ]
2417
+
2418
+ # theme.light.sidebar/theme.dark.sidebar are the only valid 3-part patterns
2419
+ if len(parts) == 3:
2420
+ # Only allow light/dark as the middle level, with sidebar as the final level
2421
+ if parts[1] in [
2422
+ CustomThemeCategories.LIGHT.value,
2423
+ CustomThemeCategories.DARK.value,
2424
+ ]:
2425
+ return parts[2] == CustomThemeCategories.SIDEBAR.value
2426
+ # sidebar cannot have nested sections (theme.sidebar.light/dark)
2427
+ return False
2428
+
2429
+ # Any nesting with 4+ parts is invalid (e.g., theme.light.sidebar.dark)
2430
+ return False
2431
+
2432
+
1740
2433
  def _update_config_with_toml(raw_toml: str, where_defined: str) -> None:
1741
2434
  """Update the config system by parsing this string.
1742
2435
 
@@ -1799,8 +2492,17 @@ def _update_config_with_toml(raw_toml: str, where_defined: str) -> None:
1799
2492
 
1800
2493
  for name, value in section_data.items():
1801
2494
  option_name = f"{section_path}.{name}"
1802
- # Process it as a nested config section if it's a custom theme sub-category
1803
- if name in [CustomThemeCategories.SIDEBAR.value]:
2495
+ # Only check for nested sections when we're already in a theme section
2496
+ if section_path.startswith("theme") and name in [
2497
+ CustomThemeCategories.SIDEBAR.value,
2498
+ CustomThemeCategories.LIGHT.value,
2499
+ CustomThemeCategories.DARK.value,
2500
+ ]:
2501
+ # Validate the theme section before processing
2502
+ if not _is_valid_theme_section(option_name):
2503
+ raise StreamlitInvalidThemeSectionError(
2504
+ option_name=option_name,
2505
+ )
1804
2506
  process_section(option_name, value)
1805
2507
  else:
1806
2508
  # It's a regular config option, set it
@@ -1951,6 +2653,13 @@ def get_config_options(
1951
2653
  for opt_name, opt_val in options_from_flags.items():
1952
2654
  _set_option(opt_name, opt_val, _DEFINED_BY_FLAG)
1953
2655
 
2656
+ # Handle theme inheritance if theme.base points to a file
2657
+ # This happens AFTER all config sources (files, env vars, flags) are processed
2658
+ # so theme.base can be set via any of those
2659
+ config_util.process_theme_inheritance(
2660
+ _config_options, _config_options_template, _set_option
2661
+ )
2662
+
1954
2663
  if old_options and config_util.server_option_changed(
1955
2664
  old_options, _config_options
1956
2665
  ):