Skip to content

Commit

Permalink
added theme support *see readme*
Browse files Browse the repository at this point in the history
  • Loading branch information
runew0lf committed Aug 23, 2023
1 parent e9e8296 commit 0c09c3e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
3 changes: 2 additions & 1 deletion example-settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
"lora_4_weight": 0.5,
"lora_5_model": "None",
"lora_5_weight": 0.5,
"save_metadata": true
"save_metadata": true,
"theme": "None"
}
1 change: 1 addition & 0 deletions modules/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def load_settings():
settings["lora_5_model"] = "None"
settings["lora_5_weight"] = modules.path.default_lora_weight
settings["save_metadata"] = True
settings["theme"] = "None"

if exists("settings.json"):
with open("settings.json") as settings_file:
Expand Down
File renamed without changes.
22 changes: 15 additions & 7 deletions webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@
import modules.async_worker as worker

from modules.sdxl_styles import style_keys, aspect_ratios, styles

from random_prompt.build_dynamic_prompt import build_dynamic_prompt

from modules.settings import load_settings

import onebutton_ui
import ui_onebutton


def load_images_handler(files):
Expand Down Expand Up @@ -48,7 +45,14 @@ def generate_clicked(*args):

settings = load_settings()

shared.gradio_root = gr.Blocks(title="RuinedFooocus " + fooocus_version.version, css=modules.html.css).queue()
if settings["theme"] == "None":
theme = gr.themes.Default()
else:
theme = settings["theme"]

shared.gradio_root = gr.Blocks(
theme=theme, title="RuinedFooocus " + fooocus_version.version, css=modules.html.css
).queue()
with shared.gradio_root:
with gr.Row():
with gr.Column():
Expand Down Expand Up @@ -213,7 +217,7 @@ def model_refresh_clicked():

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

onebutton_ui.ui_onebutton(prompt)
ui_onebutton.ui_onebutton(prompt)

advanced_checkbox.change(lambda x: gr.update(visible=x), advanced_checkbox, right_col)
ctrls = [
Expand Down Expand Up @@ -245,5 +249,9 @@ def model_refresh_clicked():
args = parser.parse_args()
favicon_path = "logo.ico"
shared.gradio_root.launch(
inbrowser=True, server_name=args.listen, server_port=args.port, share=args.share, favicon_path=favicon_path
inbrowser=True,
server_name=args.listen,
server_port=args.port,
share=args.share,
favicon_path=favicon_path,
)

0 comments on commit 0c09c3e

Please sign in to comment.