From 549b9b55a131b86732596975891c5c7c25b845b5 Mon Sep 17 00:00:00 2001 From: Blaise Date: Fri, 2 Feb 2024 23:37:13 +0100 Subject: [PATCH] Theme selector Co-authored-by: TheUserNil --- app.py | 14 +- assets/themes/Applio.py | 296 ++++++++++++++ assets/themes/loadThemes.py | 97 +++++ assets/themes/theme.json | 1 + assets/themes/theme_list.json | 751 ++++++++++++++++++++++++++++++++++ tabs/settings/themes.py | 28 ++ 6 files changed, 1184 insertions(+), 3 deletions(-) create mode 100644 assets/themes/Applio.py create mode 100644 assets/themes/loadThemes.py create mode 100644 assets/themes/theme.json create mode 100644 assets/themes/theme_list.json create mode 100644 tabs/settings/themes.py diff --git a/app.py b/app.py index 819ac3d61..6bd4e971b 100644 --- a/app.py +++ b/app.py @@ -44,16 +44,23 @@ def __init__(self, message="InstallationError"): from tabs.download.download import download_tab from tabs.tts.tts import tts_tab from tabs.settings.presence import presence_tab +from tabs.settings.themes import theme_tab -from assets.i18n.i18n import I18nAuto +import assets.themes.loadThemes as loadThemes +from assets.i18n.i18n import I18nAuto i18n = I18nAuto() from assets.discord_presence import RPCManager - RPCManager.start_presence() -with gr.Blocks(theme="ParityError/Interstellar", title="Applio") as Applio: +my_applio = loadThemes.load_json() +if my_applio: + pass +else: + my_applio = "ParityError/Interstellar" + +with gr.Blocks(theme=my_applio, title="Applio") as Applio: gr.Markdown("# Applio") gr.Markdown( i18n( @@ -85,6 +92,7 @@ def __init__(self, message="InstallationError"): with gr.Tab(i18n("Settings")): presence_tab() + theme_tab() if __name__ == "__main__": diff --git a/assets/themes/Applio.py b/assets/themes/Applio.py new file mode 100644 index 000000000..ddb795a34 --- /dev/null +++ b/assets/themes/Applio.py @@ -0,0 +1,296 @@ +from __future__ import annotations + +from typing import Iterable +import gradio as gr + +#gr.themes.builder() +from gradio.themes.base import Base +from gradio.themes.utils import colors, fonts, sizes +import time + +class Applio(Base): + def __init__( + self, + *, + primary_hue: colors.Color | str = colors.green, + secondary_hue: colors.Color | str = colors.emerald, + neutral_hue: colors.Color | str = colors.neutral, + spacing_size: sizes.Size | str = sizes.spacing_md, + radius_size: sizes.Size | str = sizes.radius_md, + text_size: sizes.Size | str = sizes.text_lg, + font: fonts.Font + | str + | Iterable[fonts.Font | str] = ( + 'Inter V', + fonts.GoogleFont('Inter'), + 'ui-sans-serif', + 'system-ui', + ), + font_mono: fonts.Font + | str + | Iterable[fonts.Font | str] = ( + 'ui-monospace', + fonts.GoogleFont("Roboto Mono"), + 'Consolas', + 'monospace', + ), + ): + super().__init__( + primary_hue=primary_hue, + secondary_hue=secondary_hue, + neutral_hue=neutral_hue, + spacing_size=spacing_size, + radius_size=radius_size, + text_size=text_size, + font=font, + font_mono=font_mono, + ) + self.name= "Applio", + self.secondary_100= "#dbeafe", + self.secondary_200= "#bfdbfe", + self.secondary_300= "#93c5fd", + self.secondary_400= "#60a5fa", + self.secondary_50= "#eff6ff", + self.secondary_500= "#3b82f6", + self.secondary_600= "#2563eb", + self.secondary_700= "#1d4ed8", + self.secondary_800= "#1e40af", + self.secondary_900= "#1e3a8a", + self.secondary_950= "#1d3660", + + super().set( + # Blaise + background_fill_primary= "black", + background_fill_primary_dark="black", + background_fill_secondary= "black", + background_fill_secondary_dark="black", + block_background_fill= "*neutral_800", + block_background_fill_dark="*neutral_800", + block_border_color= "*border_color_primary", + block_border_color_dark= "*border_color_primary", + block_border_width= "1px", + block_border_width_dark= "1px", + block_info_text_color= "*body_text_color_subdued", + block_info_text_color_dark= "*body_text_color_subdued", + block_info_text_size= "*text_sm", + block_info_text_weight= "400", + block_label_background_fill= "*background_fill_primary", + block_label_background_fill_dark= "*background_fill_secondary", + block_label_border_color= "*border_color_primary", + block_label_border_color_dark= "*border_color_primary", + block_label_border_width= "1px", + block_label_border_width_dark= "1px", + block_label_margin= "0", + block_label_padding= "*spacing_sm *spacing_lg", + block_label_radius= "calc(*radius_lg - 1px) 0 calc(*radius_lg - 1px) 0", + block_label_right_radius= "0 calc(*radius_lg - 1px) 0 calc(*radius_lg - 1px)", + block_label_shadow= "*block_shadow", + block_label_text_color= "*neutral_200", + block_label_text_color_dark= "*neutral_200", + block_label_text_weight= "400", + block_padding= "*spacing_xl", + block_radius= "*radius_md", + block_shadow= "none", + block_shadow_dark= "none", + block_title_background_fill= "rgba(46,85,65,255)", + block_title_background_fill_dark= "rgba(46,85,65,255)", + block_title_border_color= "none", + block_title_border_color_dark= "none", + block_title_border_width= "0px", + block_title_padding= "*block_label_padding", + block_title_radius= "*block_label_radius", + block_title_text_color= "*neutral_200", + block_title_text_color_dark= "*neutral_200", + block_title_text_size= "*text_md", + block_title_text_weight= "600", + body_background_fill= "black", + body_background_fill_dark= "black", + body_text_color= "white", + body_text_color_dark= "white", + body_text_color_subdued= "*neutral_400", + body_text_color_subdued_dark= "*neutral_400", + body_text_size= "*text_md", + body_text_weight= "400", + border_color_accent= "*neutral_600", + border_color_accent_dark= "*neutral_600", + border_color_primary= "*neutral_800", + border_color_primary_dark= "*neutral_800", + button_border_width= "*input_border_width", + button_border_width_dark= "*input_border_width", + button_cancel_background_fill= "*button_secondary_background_fill", + button_cancel_background_fill_dark= "*button_secondary_background_fill", + button_cancel_background_fill_hover= "*button_cancel_background_fill", + button_cancel_background_fill_hover_dark= "*button_cancel_background_fill", + button_cancel_border_color= "*button_secondary_border_color", + button_cancel_border_color_dark= "*button_secondary_border_color", + button_cancel_border_color_hover= "*button_cancel_border_color", + button_cancel_border_color_hover_dark= "*button_cancel_border_color", + button_cancel_text_color= "*button_secondary_text_color", + button_cancel_text_color_dark= "*button_secondary_text_color", + button_cancel_text_color_hover= "*button_cancel_text_color", + button_cancel_text_color_hover_dark= "*button_cancel_text_color", + button_large_padding= "*spacing_lg calc(2 * *spacing_lg)", + button_large_radius= "*radius_lg", + button_large_text_size= "*text_lg", + button_large_text_weight= "600", + button_primary_background_fill= "*primary_600", + button_primary_background_fill_dark= "*primary_600", + button_primary_background_fill_hover= "*primary_500", + button_primary_background_fill_hover_dark= "*primary_500", + button_primary_border_color= "*primary_500", + button_primary_border_color_dark= "*primary_500", + button_primary_border_color_hover= "*primary_400", + button_primary_border_color_hover_dark= "*primary_400", + button_primary_text_color= "white", + button_primary_text_color_dark= "white", + button_primary_text_color_hover= "*button_primary_text_color", + button_primary_text_color_hover_dark= "*button_primary_text_color", + button_secondary_background_fill= "transparent", + button_secondary_background_fill_dark= "transparent", + button_secondary_background_fill_hover= "*neutral_800", + button_secondary_background_fill_hover_dark= "*neutral_800", + button_secondary_border_color= "*neutral_700", + button_secondary_border_color_dark= "*neutral_700", + button_secondary_border_color_hover= "*neutral_600", + button_secondary_border_color_hover_dark= "*neutral_600", + button_secondary_text_color= "white", + button_secondary_text_color_dark= "white", + button_secondary_text_color_hover= "*button_secondary_text_color", + button_secondary_text_color_hover_dark= "*button_secondary_text_color", + button_shadow= "none", + button_shadow_active= "*shadow_inset", + button_shadow_hover= "none", + button_small_padding= "*spacing_sm calc(2 * *spacing_sm)", + button_small_radius= "*radius_lg", + button_small_text_size= "*text_md", + button_small_text_weight= "400", + button_transition= "0.3s ease all", + checkbox_background_color= "*neutral_700", + checkbox_background_color_dark= "*neutral_700", + checkbox_background_color_focus= "*checkbox_background_color", + checkbox_background_color_focus_dark= "*checkbox_background_color", + checkbox_background_color_hover= "*checkbox_background_color", + checkbox_background_color_hover_dark= "*checkbox_background_color", + checkbox_background_color_selected= "*secondary_600", + checkbox_background_color_selected_dark= "*secondary_600", + checkbox_border_color= "*neutral_700", + checkbox_border_color_dark= "*neutral_700", + checkbox_border_color_focus= "*secondary_500", + checkbox_border_color_focus_dark= "*secondary_500", + checkbox_border_color_hover= "*neutral_600", + checkbox_border_color_hover_dark= "*neutral_600", + checkbox_border_color_selected= "*secondary_600", + checkbox_border_color_selected_dark= "*secondary_600", + checkbox_border_radius= "*radius_sm", + checkbox_border_width= "*input_border_width", + checkbox_border_width_dark= "*input_border_width", + checkbox_check= "url(\"data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e\")", + checkbox_label_background_fill= "transparent", + checkbox_label_background_fill_dark= "transparent", + checkbox_label_background_fill_hover= "transparent", + checkbox_label_background_fill_hover_dark= "transparent", + checkbox_label_background_fill_selected= "transparent", + checkbox_label_background_fill_selected_dark= "transparent", + checkbox_label_border_color= "transparent", + checkbox_label_border_color_dark= "transparent", + checkbox_label_border_color_hover= "transparent", + checkbox_label_border_color_hover_dark= "transparent", + checkbox_label_border_width= "transparent", + checkbox_label_border_width_dark= "transparent", + checkbox_label_gap= "*spacing_lg", + checkbox_label_padding= "*spacing_md calc(2 * *spacing_md)", + checkbox_label_shadow= "none", + checkbox_label_text_color= "*body_text_color", + checkbox_label_text_color_dark= "*body_text_color", + checkbox_label_text_color_selected= "*checkbox_label_text_color", + checkbox_label_text_color_selected_dark= "*checkbox_label_text_color", + checkbox_label_text_size= "*text_md", + checkbox_label_text_weight= "400", + checkbox_shadow= "*input_shadow", + color_accent= "*primary_500", + color_accent_soft= "*primary_50", + color_accent_soft_dark= "*neutral_700", + container_radius= "*radius_xl", + embed_radius= "*radius_lg", + error_background_fill= "*background_fill_primary", + error_background_fill_dark= "*background_fill_primary", + error_border_color= "*border_color_primary", + error_border_color_dark= "*border_color_primary", + error_border_width= "1px", + error_border_width_dark= "1px", + error_text_color= "#ef4444", + error_text_color_dark= "#ef4444", + + form_gap_width= "0px", + input_background_fill= "*neutral_900", + input_background_fill_dark= "*neutral_900", + input_background_fill_focus= "*secondary_600", + input_background_fill_focus_dark= "*secondary_600", + input_background_fill_hover= "*input_background_fill", + input_background_fill_hover_dark= "*input_background_fill", + input_border_color= "*neutral_700", + input_border_color_dark= "*neutral_700", + input_border_color_focus= "*secondary_600", + input_border_color_focus_dark= "*primary_600", + input_border_color_hover= "*input_border_color", + input_border_color_hover_dark= "*input_border_color", + input_border_width= "1px", + input_border_width_dark= "1px", + input_padding= "*spacing_xl", + input_placeholder_color= "*neutral_500", + input_placeholder_color_dark= "*neutral_500", + input_radius= "*radius_lg", + input_shadow= "none", + input_shadow_dark= "none", + input_shadow_focus= "*input_shadow", + input_shadow_focus_dark= "*input_shadow", + input_text_size= "*text_md", + input_text_weight= "400", + layout_gap= "*spacing_xxl", + link_text_color= "*secondary_500", + link_text_color_active= "*secondary_500", + link_text_color_active_dark= "*secondary_500", + link_text_color_dark= "*secondary_500", + link_text_color_hover= "*secondary_400", + link_text_color_hover_dark= "*secondary_400", + link_text_color_visited= "*secondary_600", + link_text_color_visited_dark= "*secondary_600", + loader_color= "*color_accent", + loader_color_dark= "*color_accent", + + panel_background_fill= "*background_fill_secondary", + panel_background_fill_dark= "*background_fill_secondary", + panel_border_color= "*border_color_primary", + panel_border_color_dark= "*border_color_primary", + panel_border_width= "1px", + panel_border_width_dark= "1px", + + + prose_header_text_weight= "600", + prose_text_size= "*text_md", + prose_text_weight= "400", + radio_circle= "url(\"data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e\")", + + section_header_text_size= "*text_md", + section_header_text_weight= "400", + shadow_drop= "rgba(0,0,0,0.05) 0px 1px 2px 0px", + shadow_drop_lg= "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)", + shadow_inset= "rgba(0,0,0,0.05) 0px 2px 4px 0px inset", + shadow_spread= "3px", + shadow_spread_dark= "1px", + slider_color= "*primary_600", + slider_color_dark= "*primary_600", + + stat_background_fill= "*primary_500", + stat_background_fill_dark= "*primary_500", + table_border_color= "*neutral_700", + table_border_color_dark= "*neutral_700", + table_even_background_fill= "*neutral_950", + table_even_background_fill_dark= "*neutral_950", + table_odd_background_fill= "*neutral_900", + table_odd_background_fill_dark= "*neutral_900", + table_radius= "*radius_lg", + table_row_focus= "*color_accent_soft", + table_row_focus_dark= "*color_accent_soft", + + ) \ No newline at end of file diff --git a/assets/themes/loadThemes.py b/assets/themes/loadThemes.py new file mode 100644 index 000000000..3b52f2ae1 --- /dev/null +++ b/assets/themes/loadThemes.py @@ -0,0 +1,97 @@ +import ast +import json +import os +import importlib +import requests + + +folder = os.path.dirname(os.path.abspath(__file__)) +folder = os.path.dirname(folder) +folder = os.path.dirname(folder) +folder = os.path.join(folder, "assets", "themes") + +import sys +sys.path.append(folder) +def get_class(filename): + with open(filename, 'r') as f: + for line_number, line in enumerate(f, start=1): + if 'class ' in line: + found = line.split('class ')[1].split(':')[0].split('(')[0].strip() + return found + break + return None + +def get_list(): + + themes_from_files = [ + os.path.splitext(name)[0] + for root, _, files in os.walk(folder, topdown=False) + for name in files + if name.endswith(".py") and root == folder + ] + + json_file_path = os.path.join(folder, "theme_list.json") + + try: + with open(json_file_path, 'r') as json_file: + themes_from_url = [item["id"] for item in json.load(json_file)] + except FileNotFoundError: + themes_from_url = [] + + combined_themes = set(themes_from_files + themes_from_url) + + return list(combined_themes) + +def select_theme(name): + selected_file = name + ".py" + full_path = os.path.join(folder, selected_file) + if not os.path.exists(full_path): + with open(os.path.join(folder, 'theme.json'), 'w') as json_file: + json.dump({"file": None, "class": name}, json_file) + print(f"Theme {name} successfully selected, restart applio.") + return + class_found = get_class(full_path) + if class_found: + with open(os.path.join(folder, 'theme.json'), 'w') as json_file: + json.dump({"file": selected_file, "class": class_found}, json_file) + print(f"Theme {name} successfully selected, restart applio.") + else: + print(f"Theme {name} was not found.") + +def read_json(): + json_file_name = os.path.join(folder, 'theme.json') + try: + with open(json_file_name, 'r') as json_file: + data = json.load(json_file) + selected_file = data.get("file") + class_name = data.get("class") + if not selected_file == None and class_name: + return class_name + elif selected_file == None and class_name: + return class_name + else: + return "ParityError/Interstellar" + except: + return "ParityError/Interstellar" + +def load_json(): + json_file_name = os.path.join(folder, 'theme.json') + try: + with open(json_file_name, 'r') as json_file: + data = json.load(json_file) + selected_file = data.get("file") + class_name = data.get("class") + if not selected_file == None and class_name: + module = importlib.import_module(selected_file[:-3]) + obtained_class = getattr(module, class_name) + instance = obtained_class() + print(f"Theme Loaded: {class_name}") + return instance + elif selected_file == None and class_name: + return class_name + else: + print("The theme is incorrect.") + return None + except Exception as e: + print(f"Error Loading: {str(e)}") + return None \ No newline at end of file diff --git a/assets/themes/theme.json b/assets/themes/theme.json new file mode 100644 index 000000000..b8c917fe2 --- /dev/null +++ b/assets/themes/theme.json @@ -0,0 +1 @@ +{"file": null, "class": "naughtondale/monochrome"} \ No newline at end of file diff --git a/assets/themes/theme_list.json b/assets/themes/theme_list.json new file mode 100644 index 000000000..4bd7ba1de --- /dev/null +++ b/assets/themes/theme_list.json @@ -0,0 +1,751 @@ +[ + { + "id": "freddyaboulton/dracula_revamped", + "likes": 10, + "sha": "1cc28500a01a5e7b2605e45d2cf6260bd8c12d81", + "lastModified": "2023-03-23T19:46:29.000Z", + "screenshot_id": "freddyaboulton_dracula_revamped" + }, + { + "id": "freddyaboulton/bad-theme-space", + "likes": 0, + "sha": "3fe08b94b1198880d81bbb84f4f50a39f9588a30", + "lastModified": "2023-03-14T20:39:44.000Z", + "screenshot_id": "freddyaboulton_bad-theme-space" + }, + { + "id": "gradio/dracula_revamped", + "likes": 0, + "sha": "c1eb05480372de759eeb6e7f90c2ce962f3970c5", + "lastModified": "2023-06-23T22:34:32.000Z", + "screenshot_id": "gradio_dracula_revamped" + }, + { + "id": "abidlabs/dracula_revamped", + "likes": 0, + "sha": "efd80ef5dd8744768f514b590d5c74b4de0a80d4", + "lastModified": "2023-03-19T02:44:09.000Z", + "screenshot_id": "abidlabs_dracula_revamped" + }, + { + "id": "gradio/dracula_test", + "likes": 0, + "sha": "e75886284101799069dfcaaea391d7a89818dc6d", + "lastModified": "2023-06-11T00:24:51.000Z", + "screenshot_id": "gradio_dracula_test" + }, + { + "id": "abidlabs/dracula_test", + "likes": 0, + "sha": "1f34e8290994eabf1c3e35bf347020b41ae5d225", + "lastModified": "2023-03-19T03:01:17.000Z", + "screenshot_id": "abidlabs_dracula_test" + }, + { + "id": "gradio/seafoam", + "likes": 4, + "sha": "9509787c82360cbae3cb1211ef47a87d56390e37", + "lastModified": "2023-03-20T15:02:43.000Z", + "screenshot_id": "gradio_seafoam" + }, + { + "id": "gradio/glass", + "likes": 0, + "sha": "35109b62b14d326a8e6e0fe09ef3a3b42b314f4d", + "lastModified": "2023-03-20T19:29:05.000Z", + "screenshot_id": "gradio_glass" + }, + { + "id": "gradio/monochrome", + "likes": 7, + "sha": "96e9df3769c5f77a12814afaf150f08a6199c86d", + "lastModified": "2023-03-20T19:29:07.000Z", + "screenshot_id": "gradio_monochrome" + }, + { + "id": "gradio/soft", + "likes": 5, + "sha": "e08938f43ce81181604f3aef79e9f8742f4416c5", + "lastModified": "2023-05-04T21:43:25.000Z", + "screenshot_id": "gradio_soft" + }, + { + "id": "gradio/default", + "likes": 2, + "sha": "9985aefbea7c40c49a0244096d11c2efc91bf3b4", + "lastModified": "2023-03-20T20:39:07.000Z", + "screenshot_id": "gradio_default" + }, + { + "id": "gradio/base", + "likes": 1, + "sha": "b68adc18343e4c2ad5ea19c4b306caf31c908135", + "lastModified": "2023-03-20T20:39:09.000Z", + "screenshot_id": "gradio_base" + }, + { + "id": "abidlabs/pakistan", + "likes": 4, + "sha": "e7869fba77f0cb20180346b703f924eae7eec3a7", + "lastModified": "2023-03-21T17:20:50.000Z", + "screenshot_id": "abidlabs_pakistan" + }, + { + "id": "dawood/microsoft_windows", + "likes": 3, + "sha": "6dd26f1c3e4ae69e54b62be83574b22f08393d97", + "lastModified": "2023-03-21T02:09:15.000Z", + "screenshot_id": "dawood_microsoft_windows" + }, + { + "id": "ysharma/steampunk", + "likes": 3, + "sha": "7f751b2c0a01ec7242a3e2ad4d3c18dcace11b40", + "lastModified": "2023-03-21T14:07:23.000Z", + "screenshot_id": "ysharma_steampunk" + }, + { + "id": "ysharma/huggingface", + "likes": 0, + "sha": "70faa80d1b57da921efc91bf686a19f171960042", + "lastModified": "2023-03-22T10:31:26.000Z", + "screenshot_id": "ysharma_huggingface" + }, + { + "id": "gstaff/xkcd", + "likes": 14, + "sha": "d06e815d121a7219af517a42ed374c8d3b91fee9", + "lastModified": "2023-03-30T03:05:57.000Z", + "screenshot_id": "gstaff_xkcd" + }, + { + "id": "JohnSmith9982/small_and_pretty", + "likes": 11, + "sha": "46ce99ba8351c9a10c9ec6d353d3724e6090c610", + "lastModified": "2023-03-29T06:06:56.000Z", + "screenshot_id": "JohnSmith9982_small_and_pretty" + }, + { + "id": "abidlabs/Lime", + "likes": 1, + "sha": "7bba131266c5a9f0ecc9e5547506a9bcb9cd579c", + "lastModified": "2023-03-29T17:15:34.000Z", + "screenshot_id": "abidlabs_Lime" + }, + { + "id": "freddyaboulton/this-theme-does-not-exist-2", + "likes": 0, + "sha": "a380539363e2ee4fa32da5a8d3489cb5761f7ed0", + "lastModified": "2023-03-29T18:16:28.000Z", + "screenshot_id": "freddyaboulton_this-theme-does-not-exist-2" + }, + { + "id": "aliabid94/new-theme", + "likes": 1, + "sha": "2f889da096d7c7d65d2b692621d52b93759f64a5", + "lastModified": "2023-03-29T18:18:51.000Z", + "screenshot_id": "aliabid94_new-theme" + }, + { + "id": "aliabid94/test2", + "likes": 0, + "sha": "b8fadd91c32ebaf16dbed2bee0c49b33e4179d66", + "lastModified": "2023-03-29T18:31:23.000Z", + "screenshot_id": "aliabid94_test2" + }, + { + "id": "aliabid94/test3", + "likes": 0, + "sha": "2cad15308144ec11c3282aaa488941ae08b07fbe", + "lastModified": "2023-03-29T21:30:19.000Z", + "screenshot_id": "aliabid94_test3" + }, + { + "id": "aliabid94/test4", + "likes": 0, + "sha": "a8662c0a010747b7f1defc91d7267aa56c54cbcc", + "lastModified": "2023-03-29T21:32:08.000Z", + "screenshot_id": "aliabid94_test4" + }, + { + "id": "abidlabs/banana", + "likes": 0, + "sha": "4f981b594f3d41a97342b908242b4f2f7030eefe", + "lastModified": "2023-03-29T21:47:20.000Z", + "screenshot_id": "abidlabs_banana" + }, + { + "id": "freddyaboulton/test-blue", + "likes": 1, + "sha": "a1a13769927435a9f3429b60dc85a1bd3ddcc499", + "lastModified": "2023-03-29T22:29:19.000Z", + "screenshot_id": "freddyaboulton_test-blue" + }, + { + "id": "gstaff/sketch", + "likes": 5, + "sha": "607f3e07d3065c1607ddf6896811820131aded96", + "lastModified": "2023-03-30T03:14:26.000Z", + "screenshot_id": "gstaff_sketch" + }, + { + "id": "gstaff/whiteboard", + "likes": 5, + "sha": "5a3f849daf673e7dfa142af0b686f8292b3b2553", + "lastModified": "2023-03-30T03:21:09.000Z", + "screenshot_id": "gstaff_whiteboard" + }, + { + "id": "ysharma/llamas", + "likes": 1, + "sha": "9778b106b1384ef3fedf39d3494048aa653469ca", + "lastModified": "2023-03-31T14:34:13.000Z", + "screenshot_id": "ysharma_llamas" + }, + { + "id": "abidlabs/font-test", + "likes": 0, + "sha": "ebe83851cc8cf974cd25a3ca604c9608085652e3", + "lastModified": "2023-03-31T13:58:24.000Z", + "screenshot_id": "abidlabs_font-test" + }, + { + "id": "YenLai/Superhuman", + "likes": 2, + "sha": "e949b1ca49ed2eb75951571d155c78e21cc108ca", + "lastModified": "2023-03-31T15:33:42.000Z", + "screenshot_id": "YenLai_Superhuman" + }, + { + "id": "bethecloud/storj_theme", + "likes": 14, + "sha": "ccf66871a4dae6efa98c62239cafec38489578c8", + "lastModified": "2023-04-03T18:28:39.000Z", + "screenshot_id": "bethecloud_storj_theme" + }, + { + "id": "sudeepshouche/minimalist", + "likes": 6, + "sha": "0a4e1b7692d9c027e49fcf9ed3dea2f6fc7e4667", + "lastModified": "2023-04-01T13:42:52.000Z", + "screenshot_id": "sudeepshouche_minimalist" + }, + { + "id": "knotdgaf/gradiotest", + "likes": 1, + "sha": "16a5d6eb98e349baa104f2791bbcf706b3b56961", + "lastModified": "2023-04-01T15:46:21.000Z", + "screenshot_id": "knotdgaf_gradiotest" + }, + { + "id": "ParityError/Interstellar", + "likes": 3, + "sha": "7f604b2dca6ea3b15f2704590cf4eae76735c5a2", + "lastModified": "2023-04-03T01:11:42.000Z", + "screenshot_id": "ParityError_Interstellar" + }, + { + "id": "ParityError/Anime", + "likes": 8, + "sha": "b20cc125bcaf3c758a44b60c5420cae20ae81234", + "lastModified": "2023-04-03T07:19:29.000Z", + "screenshot_id": "ParityError_Anime" + }, + { + "id": "Ajaxon6255/Emerald_Isle", + "likes": 2, + "sha": "8d66d68389bd768c6eaa8ee92200ed14fe0dff6a", + "lastModified": "2023-04-03T04:28:52.000Z", + "screenshot_id": "Ajaxon6255_Emerald_Isle" + }, + { + "id": "ParityError/LimeFace", + "likes": 3, + "sha": "0296aa95034a011e96af5e6772fdb99d42ddddaa", + "lastModified": "2023-04-04T21:13:50.000Z", + "screenshot_id": "ParityError_LimeFace" + }, + { + "id": "finlaymacklon/smooth_slate", + "likes": 6, + "sha": "e763d0f81b66471eb34c2808a273ace2630578f6", + "lastModified": "2023-04-04T01:54:26.000Z", + "screenshot_id": "finlaymacklon_smooth_slate" + }, + { + "id": "finlaymacklon/boxy_violet", + "likes": 3, + "sha": "3a2affb3e88997c5b90bb3ff6f102390a3422258", + "lastModified": "2023-04-04T02:50:22.000Z", + "screenshot_id": "finlaymacklon_boxy_violet" + }, + { + "id": "derekzen/stardust", + "likes": 0, + "sha": "d4ebd83addcf01740267ed5d5ea7e9182b31d16d", + "lastModified": "2023-04-06T15:54:34.000Z", + "screenshot_id": "derekzen_stardust" + }, + { + "id": "EveryPizza/Cartoony-Gradio-Theme", + "likes": 2, + "sha": "1ca8980c5a1831bab3408e6830d59143c3354cb7", + "lastModified": "2023-04-06T18:39:28.000Z", + "screenshot_id": "EveryPizza_Cartoony-Gradio-Theme" + }, + { + "id": "Ifeanyi/Cyanister", + "likes": 0, + "sha": "9e4d14e63ab3757d6565bfd4bb6f8e34a9c53b9d", + "lastModified": "2023-06-30T07:48:07.000Z", + "screenshot_id": "Ifeanyi_Cyanister" + }, + { + "id": "Tshackelton/IBMPlex-DenseReadable", + "likes": 1, + "sha": "05c02cb24e349452f14fc2f027055454d9ed195e", + "lastModified": "2023-04-07T03:25:11.000Z", + "screenshot_id": "Tshackelton_IBMPlex-DenseReadable" + }, + { + "id": "snehilsanyal/scikit-learn", + "likes": 1, + "sha": "2af5369fed84af9ed119e2bb23c17f986fc3b49d", + "lastModified": "2023-04-08T19:10:45.000Z", + "screenshot_id": "snehilsanyal_scikit-learn" + }, + { + "id": "Himhimhim/xkcd", + "likes": 0, + "sha": "111e426d5277a226be694b96831b0b0b1ed65118", + "lastModified": "2023-04-10T17:04:28.000Z", + "screenshot_id": "Himhimhim_xkcd" + }, + { + "id": "shivi/calm_seafoam", + "likes": 3, + "sha": "58f305b41e0cce34f874313a5b6fe920a9a92404", + "lastModified": "2023-04-14T21:11:43.000Z", + "screenshot_id": "shivi_calm_seafoam" + }, + { + "id": "nota-ai/theme", + "likes": 3, + "sha": "7256dd32c053cc6b06e381d80848e4de6d45d67f", + "lastModified": "2023-07-18T01:57:48.000Z", + "screenshot_id": "nota-ai_theme" + }, + { + "id": "rawrsor1/Everforest", + "likes": 0, + "sha": "eb673345952d1b1df2adf3a3700a9ea18f329a64", + "lastModified": "2023-04-18T07:11:52.000Z", + "screenshot_id": "rawrsor1_Everforest" + }, + { + "id": "SebastianBravo/simci_css", + "likes": 2, + "sha": "4f46131c6a54398d36859b3bf54c0b4e29914537", + "lastModified": "2023-04-21T06:32:21.000Z", + "screenshot_id": "SebastianBravo_simci_css" + }, + { + "id": "rottenlittlecreature/Moon_Goblin", + "likes": 1, + "sha": "470661a89252eebfdf48f93e5bfbe7495e948565", + "lastModified": "2023-04-27T04:35:34.000Z", + "screenshot_id": "rottenlittlecreature_Moon_Goblin" + }, + { + "id": "abidlabs/test-yellow", + "likes": 0, + "sha": "941816b525f270fa2753af7b5977f26523e434f3", + "lastModified": "2023-04-25T00:19:36.000Z", + "screenshot_id": "abidlabs_test-yellow" + }, + { + "id": "abidlabs/test-yellow3", + "likes": 0, + "sha": "98468b5d715e6ac8030976a47cf4cf489bebf406", + "lastModified": "2023-04-25T00:46:07.000Z", + "screenshot_id": "abidlabs_test-yellow3" + }, + { + "id": "idspicQstitho/dracula_revamped", + "likes": 0, + "sha": "e9563fce60dc1bc1f12e1529a935ce26596a353a", + "lastModified": "2023-07-02T16:37:11.000Z", + "screenshot_id": "idspicQstitho_dracula_revamped" + }, + { + "id": "kfahn/AnimalPose", + "likes": 0, + "sha": "07390407d03456a58f6bc33a99773e6f1ee07e2a", + "lastModified": "2023-05-02T14:10:38.000Z", + "screenshot_id": "kfahn_AnimalPose" + }, + { + "id": "HaleyCH/HaleyCH_Theme", + "likes": 4, + "sha": "0ad24ea15844ee5bdfecd122a438536008ef9c13", + "lastModified": "2023-05-01T14:55:54.000Z", + "screenshot_id": "HaleyCH_HaleyCH_Theme" + }, + { + "id": "simulKitke/dracula_test", + "likes": 0, + "sha": "a6c39308892f82fdba58a34b28008b557d68024f", + "lastModified": "2023-07-01T11:16:49.000Z", + "screenshot_id": "simulKitke_dracula_test" + }, + { + "id": "braintacles/CrimsonNight", + "likes": 0, + "sha": "40f28be62631e1bfb670d3f8adfb8359ccff1b59", + "lastModified": "2023-05-04T02:24:37.000Z", + "screenshot_id": "braintacles_CrimsonNight" + }, + { + "id": "wentaohe/whiteboardv2", + "likes": 0, + "sha": "0fa1b6a39c6a0c2a47aa9bcd29cce285857acb74", + "lastModified": "2023-05-05T17:12:48.000Z", + "screenshot_id": "wentaohe_whiteboardv2" + }, + { + "id": "reilnuud/polite", + "likes": 1, + "sha": "eabe137d534934744c2c64b5204244af9b79d806", + "lastModified": "2023-05-05T20:58:11.000Z", + "screenshot_id": "reilnuud_polite" + }, + { + "id": "remilia/Ghostly", + "likes": 1, + "sha": "6552d91a2d81d2c7481f328fe0fa7f3b70f82e99", + "lastModified": "2023-05-11T20:28:34.000Z", + "screenshot_id": "remilia_Ghostly" + }, + { + "id": "Franklisi/darkmode", + "likes": 0, + "sha": "54ee9086c8bbc4b11b9a4c2ce7959db45b1cbd96", + "lastModified": "2023-05-20T00:48:03.000Z", + "screenshot_id": "Franklisi_darkmode" + }, + { + "id": "coding-alt/soft", + "likes": 0, + "sha": "b7c174e1289263db3bd8f268ef9e5b8707ef26ca", + "lastModified": "2023-05-24T08:41:09.000Z", + "screenshot_id": "coding-alt_soft" + }, + { + "id": "xiaobaiyuan/theme_land", + "likes": 1, + "sha": "b6c1b9bf490c3a542860a38667ac357fedae5ead", + "lastModified": "2023-06-10T07:49:57.000Z", + "screenshot_id": "xiaobaiyuan_theme_land" + }, + { + "id": "step-3-profit/Midnight-Deep", + "likes": 1, + "sha": "a0ccf4a9e8ca399e7cff8a381b524fd69ce28868", + "lastModified": "2023-05-27T09:06:52.000Z", + "screenshot_id": "step-3-profit_Midnight-Deep" + }, + { + "id": "xiaobaiyuan/theme_demo", + "likes": 0, + "sha": "0efce78e4e9815d7fdb5beb3ab0f27e9e9a93dfd", + "lastModified": "2023-05-27T16:38:54.000Z", + "screenshot_id": "xiaobaiyuan_theme_demo" + }, + { + "id": "Taithrah/Minimal", + "likes": 0, + "sha": "b3efc95e5bf40382d049a194e4a2c043bcd88900", + "lastModified": "2023-07-06T23:10:18.000Z", + "screenshot_id": "Taithrah_Minimal" + }, + { + "id": "Insuz/SimpleIndigo", + "likes": 0, + "sha": "3184021c56adbf924658521388c705abe778ede7", + "lastModified": "2023-06-05T23:08:29.000Z", + "screenshot_id": "Insuz_SimpleIndigo" + }, + { + "id": "zkunn/Alipay_Gradio_theme", + "likes": 1, + "sha": "93407d4ecdeef5f282ea6e221b5c12463cd5c840", + "lastModified": "2023-06-06T12:30:25.000Z", + "screenshot_id": "zkunn_Alipay_Gradio_theme" + }, + { + "id": "Insuz/Mocha", + "likes": 1, + "sha": "386cd8cedf80e6d0ad3a94a40c723f00b177ed76", + "lastModified": "2023-06-08T09:41:27.000Z", + "screenshot_id": "Insuz_Mocha" + }, + { + "id": "xiaobaiyuan/theme_brief", + "likes": 0, + "sha": "a80c4b450c7a9bf7a925465578d494c89171b4ac", + "lastModified": "2023-06-10T04:44:42.000Z", + "screenshot_id": "xiaobaiyuan_theme_brief" + }, + { + "id": "Ama434/434-base-Barlow", + "likes": 0, + "sha": "34aa703bd83fbe0c9b8ab5cf44b64ee9b3a1b82f", + "lastModified": "2023-06-10T16:49:10.000Z", + "screenshot_id": "Ama434_434-base-Barlow" + }, + { + "id": "Ama434/def_barlow", + "likes": 0, + "sha": "2b31ff91bad69790c6e6df83127dc650d6d29239", + "lastModified": "2023-06-10T17:37:57.000Z", + "screenshot_id": "Ama434_def_barlow" + }, + { + "id": "Ama434/neutral-barlow", + "likes": 1, + "sha": "f1d041482761ceab666dbb8dc674d86c53ca54bd", + "lastModified": "2023-06-10T18:04:03.000Z", + "screenshot_id": "Ama434_neutral-barlow" + }, + { + "id": "dawood/dracula_test", + "likes": 0, + "sha": "903e5b7519138881215eb0d249e29e2fe8e8a024", + "lastModified": "2023-06-11T00:06:06.000Z", + "screenshot_id": "dawood_dracula_test" + }, + { + "id": "nuttea/Softblue", + "likes": 0, + "sha": "08ffb0293e2b1c9e32a68d2d0e039a2b7d2c2d11", + "lastModified": "2023-06-12T14:46:24.000Z", + "screenshot_id": "nuttea_Softblue" + }, + { + "id": "BlueDancer/Alien_Diffusion", + "likes": 0, + "sha": "5667eb6299989d0deb9bddd36678aee016b733b4", + "lastModified": "2023-06-20T01:03:46.000Z", + "screenshot_id": "BlueDancer_Alien_Diffusion" + }, + { + "id": "naughtondale/monochrome", + "likes": 0, + "sha": "a40746c7d69e3d733aa43d05033c3846603f59f1", + "lastModified": "2023-07-05T16:30:37.000Z", + "screenshot_id": "naughtondale_monochrome" + }, + { + "id": "Dagfinn1962/standard", + "likes": 0, + "sha": "b238047d5dac739d27daeb14bd871249166788a0", + "lastModified": "2023-07-08T23:22:59.000Z", + "screenshot_id": "Dagfinn1962_standard" + }, + { + "id": "Dagfinn1962/goodtheme", + "likes": 0, + "sha": "870ed9e826152256ba48b407538136712f6d5b35", + "lastModified": "2023-07-09T06:17:18.000Z", + "screenshot_id": "Dagfinn1962_goodtheme" + }, + { + "id": "adam-haile/DSTheme", + "likes": 0, + "sha": "c45694423d44928ae827108905f7b9b0fb0f5091", + "lastModified": "2023-07-13T15:27:28.000Z", + "screenshot_id": "adam-haile_DSTheme" + }, + { + "id": "karthikeyan-adople/hudsonhayes", + "likes": 0, + "sha": "fa1aeecfbb9601334d7ce631ebc11a1d1090d385", + "lastModified": "2023-07-15T09:28:19.000Z", + "screenshot_id": "karthikeyan-adople_hudsonhayes" + }, + { + "id": "mindrage/darkmode_grey_red_condensed", + "likes": 0, + "sha": "3164eec463ee4f8e85e398c2d2bb9150c2960e2c", + "lastModified": "2023-07-17T11:14:28.000Z", + "screenshot_id": "mindrage_darkmode_grey_red_condensed" + }, + { + "id": "mindrage/darkmode_grey_cyan_condensed", + "likes": 0, + "sha": "8519814e684eda3a2257e861db469d814e6b7865", + "lastModified": "2023-07-17T20:11:55.000Z", + "screenshot_id": "mindrage_darkmode_grey_cyan_condensed" + }, + { + "id": "karthikeyan-adople/hudsonhayes-dark", + "likes": 0, + "sha": "0c9f3a1f9b69df51db340d2eae42c37e646f810e", + "lastModified": "2023-07-18T07:53:37.000Z", + "screenshot_id": "karthikeyan-adople_hudsonhayes-dark" + }, + { + "id": "jingwora/calm_seafoam", + "likes": 0, + "sha": "8deebdbbadc8a374bcd4459ec6a8929596c9e0d1", + "lastModified": "2023-07-18T11:04:40.000Z", + "screenshot_id": "jingwora_calm_seafoam" + }, + { + "id": "karthikeyan-adople/hudsonhayes-blue", + "likes": 0, + "sha": "a752039a807e2d352eb55f352a91371b5a51d3ca", + "lastModified": "2023-07-18T13:03:12.000Z", + "screenshot_id": "karthikeyan-adople_hudsonhayes-blue" + }, + { + "id": "karthikeyan-adople/hudsonhayes-dark1", + "likes": 0, + "sha": "39ce1038cf2d1d6b189ef2d8d9add1de2a0974c5", + "lastModified": "2023-07-19T05:55:40.000Z", + "screenshot_id": "karthikeyan-adople_hudsonhayes-dark1" + }, + { + "id": "Jameswiller/Globe", + "likes": 0, + "sha": "534f4cc09d206f89ad2dfc779fc15e42ad6266c2", + "lastModified": "2023-07-20T14:29:29.000Z", + "screenshot_id": "Jameswiller_Globe" + }, + { + "id": "karthikeyan-adople/hudsonhayes-gray", + "likes": 0, + "sha": "f34a830663d9e11fd1d6d121481590790c8fb102", + "lastModified": "2023-07-21T12:44:13.000Z", + "screenshot_id": "karthikeyan-adople_hudsonhayes-gray" + }, + { + "id": "patrickosornio/my_theme1", + "likes": 0, + "sha": "1c3c7e6eb7cdf262e0ddf266dfc9ea1af3b40d7c", + "lastModified": "2023-07-24T23:42:02.000Z", + "screenshot_id": "patrickosornio_my_theme1" + }, + { + "id": "earneleh/paris", + "likes": 0, + "sha": "6bb627aa7597ae7f8ca82a2f21735ced98b38eb8", + "lastModified": "2023-07-25T02:05:00.000Z", + "screenshot_id": "earneleh_paris" + }, + { + "id": "rezponze/TeeFussion", + "likes": 0, + "sha": "4b57e14ac3369d669aae6c98beaeaae95a282d99", + "lastModified": "2023-07-25T13:29:28.000Z", + "screenshot_id": "rezponze_TeeFussion" + }, + { + "id": "etstertest/test", + "likes": 0, + "sha": "e86a268f7695c4780de7b5047f91ab8260255718", + "lastModified": "2023-07-25T15:36:59.000Z", + "screenshot_id": "etstertest_test" + }, + { + "id": "dwancin/theme", + "likes": 0, + "sha": "993b1279634f5f63c2b9a0c5c9be26ab8e06a54f", + "lastModified": "2023-08-14T01:38:33.000Z", + "screenshot_id": "dwancin_theme" + }, + { + "id": "Arkaine/Carl_Glow", + "likes": 0, + "sha": "577e313eeeffacb8edf4c3558ce0d2cf6c524caa", + "lastModified": "2023-07-31T08:53:51.000Z", + "screenshot_id": "Arkaine_Carl_Glow" + }, + { + "id": "minatosnow/qaigpt", + "likes": 0, + "sha": "7f5b8e9f2a0269866217b681a37fa97d98dee746", + "lastModified": "2023-08-07T16:46:14.000Z", + "screenshot_id": "minatosnow_qaigpt" + }, + { + "id": "DitchDenis/Denis", + "likes": 0, + "sha": "6eab339d65ae464ff29c60a07de019eabca95940", + "lastModified": "2023-08-05T09:27:43.000Z", + "screenshot_id": "DitchDenis_Denis" + }, + { + "id": "pikto/theme", + "likes": 0, + "sha": "056436e1b043e64ec89f7237bc87bc91248f387f", + "lastModified": "2023-08-06T20:40:20.000Z", + "screenshot_id": "pikto_theme" + }, + { + "id": "gary109/black", + "likes": 0, + "sha": "c7f34c52b967173fc3d57d393fedd475f888fad3", + "lastModified": "2023-08-08T02:32:00.000Z", + "screenshot_id": "gary109_black" + }, + { + "id": "gary109/black_base", + "likes": 0, + "sha": "438aff99414b07717a17c03fa82791efe0dfde2a", + "lastModified": "2023-08-08T02:33:22.000Z", + "screenshot_id": "gary109_black_base" + }, + { + "id": "gary109/Emerald_Isle", + "likes": 0, + "sha": "2848f04e27a98ccfc479ccac3831c8c5fd81af8a", + "lastModified": "2023-08-08T03:15:00.000Z", + "screenshot_id": "gary109_Emerald_Isle" + }, + { + "id": "gary109/llamas", + "likes": 0, + "sha": "6f75c08b3c29f1420105ba08961c0e67a0c151c0", + "lastModified": "2023-08-08T03:15:31.000Z", + "screenshot_id": "gary109_llamas" + }, + { + "id": "gary109/HaleyCH_Theme", + "likes": 1, + "sha": "6f34b3ee1e9df30820362ab1efc8162f870e12ea", + "lastModified": "2023-08-08T03:18:38.000Z", + "screenshot_id": "gary109_HaleyCH_Theme" + }, + { + "id": "dumdumai/D-GradioTheme", + "likes": 0, + "sha": "774ac1f0af04f1ba8f08bc52407bc536486e0942", + "lastModified": "2023-08-12T14:31:57.000Z", + "screenshot_id": "dumdumai_D-GradioTheme" + }, + { + "id": "gl198976/The-Rounded", + "likes": 0, + "sha": "8580b9d44d98cd4bcdbb0194994309331f041d70", + "lastModified": "2023-08-14T02:52:05.000Z", + "screenshot_id": "gl198976_The-Rounded" + }, + { + "id": "NoCrypt/miku", + "likes": 0, + "sha": "eb068530367ccb43ea327fbee54dd07c66a4b538", + "lastModified": "2023-08-15T00:28:30.000Z", + "screenshot_id": "NoCrypt_miku" + } +] diff --git a/tabs/settings/themes.py b/tabs/settings/themes.py new file mode 100644 index 000000000..8d87f46a4 --- /dev/null +++ b/tabs/settings/themes.py @@ -0,0 +1,28 @@ +import os +import sys +import base64 +import pathlib +import tempfile +import gradio as gr + +from assets.i18n.i18n import I18nAuto +import assets.themes.loadThemes as loadThemes +now_dir = os.getcwd() +sys.path.append("..") + +i18n = I18nAuto() + +def theme_tab(): + with gr.Row(): + with gr.Column(): + themes_select = gr.Dropdown( + loadThemes.get_list(), + value=loadThemes.read_json(), + label=i18n("Theme"), + visible=True, + ) + themes_select.change( + fn=loadThemes.select_theme, + inputs=themes_select, + outputs=[], + ) \ No newline at end of file