From 4ea4b7ecbd0ccbe86291b4cac1076b6aff810211 Mon Sep 17 00:00:00 2001 From: Elijah Date: Fri, 20 Sep 2024 14:01:05 +0000 Subject: [PATCH] Make `reflex init --ai` use light mode --- reflex/utils/prerequisites.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/reflex/utils/prerequisites.py b/reflex/utils/prerequisites.py index 6433cd3462..7173e48728 100644 --- a/reflex/utils/prerequisites.py +++ b/reflex/utils/prerequisites.py @@ -1481,13 +1481,20 @@ def replace_content(_match): main_module_path = Path(app_name, app_name + constants.Ext.PY) main_module_code = main_module_path.read_text() - main_module_path.write_text( - re.sub( - r"def index\(\).*:\n([^\n]\s+.*\n+)+", - replace_content, - main_module_code, - ) + + main_module_code = re.sub( + r"def index\(\).*:\n([^\n]\s+.*\n+)+", + replace_content, + main_module_code, + ) + # Make the app use light mode until flexgen enforces the conversion of + # tailwind colors to radix colors. + main_module_code = re.sub( + r"app\s*=\s*rx\.App\(\s*\)", + 'app = rx.App(theme=rx.theme(color_mode="light"))', + main_module_code, ) + main_module_path.write_text(main_module_code) def format_address_width(address_width) -> int | None: