From 1424eeac6c4a8003420d819945a46fec2fcdb676 Mon Sep 17 00:00:00 2001 From: TomSchimansky Date: Sun, 27 Nov 2022 21:33:12 +0100 Subject: [PATCH] theme chnages --- customtkinter/assets/themes/blue.json | 2 +- customtkinter/assets/themes/green.json | 2 +- customtkinter/windows/widgets/font/ctk_font.py | 9 +++++---- test/manual_integration_tests/test_theme_colors.py | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/customtkinter/assets/themes/blue.json b/customtkinter/assets/themes/blue.json index 4626513..bca0b2b 100644 --- a/customtkinter/assets/themes/blue.json +++ b/customtkinter/assets/themes/blue.json @@ -130,7 +130,7 @@ "DropdownMenu": { "fg_color": ["gray90", "gray20"], "hover_color": ["gray75", "gray28"], - "text_color": ["#DCE4EE", "#DCE4EE"] + "text_color": ["gray10", "gray90"] }, "CTkFont": { "macOS": { diff --git a/customtkinter/assets/themes/green.json b/customtkinter/assets/themes/green.json index 1b28c75..14cd8c6 100644 --- a/customtkinter/assets/themes/green.json +++ b/customtkinter/assets/themes/green.json @@ -130,7 +130,7 @@ "DropdownMenu": { "fg_color": ["gray90", "gray20"], "hover_color": ["gray75", "gray28"], - "text_color": ["#DCE4EE", "#DCE4EE"] + "text_color": ["gray10", "gray90"] }, "CTkFont": { "macOS": { diff --git a/customtkinter/windows/widgets/font/ctk_font.py b/customtkinter/windows/widgets/font/ctk_font.py index 3c93eaa..64c6af0 100644 --- a/customtkinter/windows/widgets/font/ctk_font.py +++ b/customtkinter/windows/widgets/font/ctk_font.py @@ -1,6 +1,6 @@ from tkinter.font import Font import copy -from typing import List, Callable, Tuple, Optional +from typing import List, Callable, Tuple, Optional, Literal from ..theme.theme_manager import ThemeManager @@ -23,8 +23,8 @@ class CTkFont(Font): def __init__(self, family: Optional[str] = None, size: Optional[int] = None, - weight: str = None, - slant: str = "roman", + weight: Literal["normal", "bold"] = None, + slant: Literal["italic", "roman"] = "roman", underline: bool = False, overstrike: bool = False): @@ -51,8 +51,9 @@ class CTkFont(Font): self._size_configure_callback_list.remove(callback) def create_scaled_tuple(self, font_scaling: float) -> Tuple[str, int, str]: + """ return scaled tuple representation of font in the form (family: str, size: int, style: str)""" - return self._family, round(self._size * font_scaling), self._tuple_style_string + return self._family, round(-abs(self._size) * font_scaling), self._tuple_style_string def config(self, *args, **kwargs): raise AttributeError("'config' is not implemented for CTk widgets. For consistency, always use 'configure' instead.") diff --git a/test/manual_integration_tests/test_theme_colors.py b/test/manual_integration_tests/test_theme_colors.py index a2b0721..e1fe20c 100644 --- a/test/manual_integration_tests/test_theme_colors.py +++ b/test/manual_integration_tests/test_theme_colors.py @@ -2,7 +2,7 @@ import tkinter import customtkinter customtkinter.set_appearance_mode("dark") # Modes: "System" (standard), "Dark", "Light" -customtkinter.set_default_color_theme("dark-blue") # Themes: "blue" (standard), "green", "dark-blue" +customtkinter.set_default_color_theme("blue") # Themes: "blue" (standard), "green", "dark-blue" app = customtkinter.CTk() app.geometry("1100x900")