瀏覽代碼

Apply default theme to apps (#2320)

Nikhil Rao 1 年之前
父節點
當前提交
cfb9d44e0c
共有 2 個文件被更改,包括 3 次插入2 次删除
  1. 2 1
      reflex/app.py
  2. 1 1
      tests/test_app.py

+ 2 - 1
reflex/app.py

@@ -43,6 +43,7 @@ from reflex.components.navigation.client_side_routing import (
     Default404Page,
     wait_for_client_redirect,
 )
+from reflex.components.radix import themes
 from reflex.config import get_config
 from reflex.event import Event, EventHandler, EventSpec
 from reflex.middleware import HydrateMiddleware, Middleware
@@ -131,7 +132,7 @@ class App(Base):
     background_tasks: Set[asyncio.Task] = set()
 
     # The radix theme for the entire app
-    theme: Optional[Component] = None
+    theme: Optional[Component] = themes.theme(accent_color="blue")
 
     def __init__(self, *args, **kwargs):
         """Initialize the app.

+ 1 - 1
tests/test_app.py

@@ -1199,7 +1199,7 @@ def compilable_app(tmp_path) -> Generator[tuple[App, Path], None, None]:
     web_dir = app_path / ".web"
     web_dir.mkdir(parents=True)
     (web_dir / "package.json").touch()
-    app = App()
+    app = App(theme=None)
     app.get_frontend_packages = unittest.mock.Mock()
     with chdir(app_path):
         yield app, web_dir