added purple theme

This commit is contained in:
Bamboooz 2023-04-27 17:46:50 +02:00
parent 86ba99c2ab
commit e46fd1e954
4 changed files with 159 additions and 4 deletions

View File

@ -0,0 +1,155 @@
{
"CTk": {
"fg_color": ["gray92", "gray14"]
},
"CTkToplevel": {
"fg_color": ["gray92", "gray14"]
},
"CTkFrame": {
"corner_radius": 6,
"border_width": 0,
"fg_color": ["gray86", "gray17"],
"top_fg_color": ["gray81", "gray20"],
"border_color": ["gray65", "gray28"]
},
"CTkButton": {
"corner_radius": 6,
"border_width": 0,
"fg_color": ["#a17aff", "#7d3cff"],
"hover_color": ["#7d3cff", "#5a00cc"],
"border_color": ["#3E454A", "#949A9F"],
"text_color": ["gray98", "#e6e6e6"],
"text_color_disabled": ["gray78", "gray68"]
},
"CTkLabel": {
"corner_radius": 0,
"fg_color": "transparent",
"text_color": ["gray10", "#DCE4EE"]
},
"CTkEntry": {
"corner_radius": 6,
"border_width": 2,
"fg_color": ["#F9F9FA", "#343638"],
"border_color": ["#979DA2", "#565B5E"],
"text_color": ["gray10", "#DCE4EE"],
"placeholder_text_color": ["gray52", "gray62"]
},
"CTkCheckbox": {
"corner_radius": 6,
"border_width": 3,
"fg_color": ["#a17aff", "#7d3cff"],
"border_color": ["#3E454A", "#949A9F"],
"hover_color": ["#7d3cff", "#5a00cc"],
"checkmark_color": ["#DCE4EE", "gray90"],
"text_color": ["gray10", "#DCE4EE"],
"text_color_disabled": ["gray60", "gray45"]
},
"CTkSwitch": {
"corner_radius": 1000,
"border_width": 3,
"button_length": 0,
"fg_color": ["#b8a8ff", "#7d3cff"],
"progress_color": ["#a17aff", "#7d3cff"],
"button_color": ["#4c4c4c", "#d9d9d9"],
"button_hover_color": ["#1a1a1a", "#f2f2f2"],
"text_color": ["gray10", "#DCE4EE"],
"text_color_disabled": ["gray60", "gray45"]
},
"CTkRadiobutton": {
"corner_radius": 1000,
"border_width_checked": 6,
"border_width_unchecked": 3,
"fg_color": ["#a17aff", "#7d3cff"],
"border_color": ["#3E454A", "#949A9F"],
"hover_color": ["#7d3cff", "#5a00cc"],
"text_color": ["gray10", "#DCE4EE"],
"text_color_disabled": ["gray60", "gray45"]
},
"CTkProgressBar": {
"corner_radius": 1000,
"border_width": 0,
"fg_color": ["#b8a8ff", "#7d3cff"],
"progress_color": ["#a17aff", "#7d3cff"],
"border_color": ["gray", "gray"]
},
"CTkSlider": {
"corner_radius": 1000,
"button_corner_radius": 1000,
"border_width": 6,
"button_length": 0,
"fg_color": ["#b8a8ff", "#7d3cff"],
"progress_color": ["#4c4c4c", "#a17aff"],
"button_color": ["#a17aff", "#7d3cff"],
"button_hover_color": ["#7d3cff", "#5a00cc"]
},
"CTkOptionMenu": {
"corner_radius": 6,
"fg_color": ["#a17aff", "#7d3cff"],
"button_color": ["#7d3cff", "#5a00cc"],
"button_hover_color": ["#5a00cc", "#1f1f1f"],
"text_color": ["#f2f2f2", "#e6e6e6"],
"text_color_disabled": ["gray78", "gray68"]
},
"CTkComboBox": {
"corner_radius": 6,
"border_width": 2,
"fg_color": ["#e6e6e6", "#2a2a2a"],
"border_color": ["#7d7d7d", "#4c4c4c"],
"button_color": ["#7d7d7d", "#4c4c4c"],
"button_hover_color": ["#4c4c4c", "#1a1a1a"],
"text_color": ["gray10", "#DCE4EE"],
"text_color_disabled": ["gray50", "gray45"]
},
"CTkScrollbar": {
"corner_radius": 1000,
"border_spacing": 4,
"fg_color": "transparent",
"button_color": ["gray55", "gray41"],
"button_hover_color": ["gray40", "gray53"]
},
"CTkSegmentedButton": {
"corner_radius": 6,
"border_width": 2,
"fg_color": ["#979DA2", "gray29"],
"selected_color": ["#a17aff", "#7d3cff"],
"selected_hover_color": ["#7d3cff", "#5a00cc"],
"unselected_color": ["#979DA2", "gray29"],
"unselected_hover_color": ["gray70", "gray41"],
"text_color": ["#f2f2f2", "#e6e6e6"],
"text_color_disabled": ["gray78", "gray68"]
},
"CTkTextbox": {
"corner_radius": 6,
"border_width": 0,
"fg_color": ["#F9F9FA", "gray23"],
"border_color": ["#7d7d7d", "#4c4c4c"],
"text_color":["gray10", "#DCE4EE"],
"scrollbar_button_color": ["#4c4c4c", "#1a1a1a"],
"scrollbar_button_hover_color": ["#2a2a2a", "#3c3c3c"]
},
"CTkScrollableFrame": {
"label_fg_color": ["gray78", "gray23"]
},
"DropdownMenu": {
"fg_color": ["gray90", "gray20"],
"hover_color": ["gray75", "gray28"],
"text_color": ["gray10", "gray90"]
},
"CTkFont": {
"macOS": {
"family": "SF Display",
"size": 13,
"weight": "normal"
},
"Windows": {
"family": "Roboto",
"size": 13,
"weight": "normal"
},
"Linux": {
"family": "Roboto",
"size": 13,
"weight": "normal"
}
}
}

View File

@ -8,14 +8,14 @@ from typing import List, Union
class ThemeManager:
theme: dict = {} # contains all the theme data
_built_in_themes: List[str] = ["blue", "green", "dark-blue", "sweetkind"]
_built_in_themes: List[str] = ["blue", "green", "dark-blue", "sweetkind", "purple"]
_currently_loaded_theme: Union[str, None] = None
@classmethod
def load_theme(cls, theme_name_or_path: str):
script_directory = os.path.dirname(os.path.abspath(__file__))
if theme_name_or_path in cls._built_in_themes:
if theme_name_or_path.lower() in cls._built_in_themes:
customtkinter_path = pathlib.Path(script_directory).parent.parent.parent
with open(os.path.join(customtkinter_path, "assets", "themes", f"{theme_name_or_path}.json"), "r") as f:
cls.theme = json.load(f)

View File

@ -3,7 +3,7 @@ import tkinter.messagebox
import customtkinter
customtkinter.set_appearance_mode("System") # Modes: "System" (standard), "Dark", "Light"
customtkinter.set_default_color_theme("blue") # Themes: "blue" (standard), "green", "dark-blue"
customtkinter.set_default_color_theme("blue") # Themes: "blue" (standard), "green", "dark-blue", "purple"
class App(customtkinter.CTk):

View File

@ -1,7 +1,7 @@
import customtkinter
customtkinter.set_appearance_mode("dark") # Modes: "System" (standard), "Dark", "Light"
customtkinter.set_default_color_theme("blue") # Themes: "blue" (standard), "green", "dark-blue"
customtkinter.set_default_color_theme("blue") # Themes: "blue" (standard), "green", "dark-blue", "purple"
app = customtkinter.CTk()
app.geometry("400x780")