Skip to content

Commit 0c09c3e

Browse files
committed
added theme support *see readme*
1 parent e9e8296 commit 0c09c3e

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

example-settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@
2424
"lora_4_weight": 0.5,
2525
"lora_5_model": "None",
2626
"lora_5_weight": 0.5,
27-
"save_metadata": true
27+
"save_metadata": true,
28+
"theme": "None"
2829
}

modules/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def load_settings():
3131
settings["lora_5_model"] = "None"
3232
settings["lora_5_weight"] = modules.path.default_lora_weight
3333
settings["save_metadata"] = True
34+
settings["theme"] = "None"
3435

3536
if exists("settings.json"):
3637
with open("settings.json") as settings_file:
File renamed without changes.

webui.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,9 @@
99
import modules.async_worker as worker
1010

1111
from modules.sdxl_styles import style_keys, aspect_ratios, styles
12-
13-
from random_prompt.build_dynamic_prompt import build_dynamic_prompt
14-
1512
from modules.settings import load_settings
1613

17-
import onebutton_ui
14+
import ui_onebutton
1815

1916

2017
def load_images_handler(files):
@@ -48,7 +45,14 @@ def generate_clicked(*args):
4845

4946
settings = load_settings()
5047

51-
shared.gradio_root = gr.Blocks(title="RuinedFooocus " + fooocus_version.version, css=modules.html.css).queue()
48+
if settings["theme"] == "None":
49+
theme = gr.themes.Default()
50+
else:
51+
theme = settings["theme"]
52+
53+
shared.gradio_root = gr.Blocks(
54+
theme=theme, title="RuinedFooocus " + fooocus_version.version, css=modules.html.css
55+
).queue()
5256
with shared.gradio_root:
5357
with gr.Row():
5458
with gr.Column():
@@ -213,7 +217,7 @@ def model_refresh_clicked():
213217

214218
model_refresh.click(model_refresh_clicked, [], [base_model, refiner_model] + lora_ctrls)
215219

216-
onebutton_ui.ui_onebutton(prompt)
220+
ui_onebutton.ui_onebutton(prompt)
217221

218222
advanced_checkbox.change(lambda x: gr.update(visible=x), advanced_checkbox, right_col)
219223
ctrls = [
@@ -245,5 +249,9 @@ def model_refresh_clicked():
245249
args = parser.parse_args()
246250
favicon_path = "logo.ico"
247251
shared.gradio_root.launch(
248-
inbrowser=True, server_name=args.listen, server_port=args.port, share=args.share, favicon_path=favicon_path
252+
inbrowser=True,
253+
server_name=args.listen,
254+
server_port=args.port,
255+
share=args.share,
256+
favicon_path=favicon_path,
249257
)

0 commit comments

Comments
 (0)