WIP THEME DETECT
This commit is contained in:
parent
a02c6aa1cd
commit
d8ffaea25a
3 changed files with 126 additions and 5 deletions
|
@ -5,10 +5,9 @@ from PIL import Image, ImageTk
|
|||
|
||||
import download_main
|
||||
from gui_starfield import StarField
|
||||
import darkdetect
|
||||
from json_main import save_package
|
||||
|
||||
def run_installer(download_folder_tmp):
|
||||
def run_installer(download_folder_tmp, col_background, col_theme, col_isDark):
|
||||
global visible_widgets, tab_combobox # Declare tab_combobox as a global variable
|
||||
|
||||
app = CTk()
|
||||
|
@ -18,7 +17,7 @@ def run_installer(download_folder_tmp):
|
|||
app.minsize(width=800, height=600)
|
||||
app.maxsize(width=800, height=600)
|
||||
|
||||
app.isDark = darkdetect.isDark()
|
||||
app.isDark = col_isDark
|
||||
|
||||
if app.isDark:
|
||||
set_default_color_theme("dark-blue")
|
||||
|
|
|
@ -32,5 +32,7 @@ def get_gtk_theme_colors(theme_name):
|
|||
print(f"Error: {e}")
|
||||
return None, None
|
||||
|
||||
background, foreground = get_gtk_theme_colors(theme_name)
|
||||
print(f"Background color: #{background}, Foreground color: #{foreground}")
|
||||
|
||||
# # example use
|
||||
# background, foreground = get_gtk_theme_colors(theme_name)
|
||||
# print(f"Background color: #{background}, Foreground color: #{foreground}")
|
120
src/theme_win.py
Normal file
120
src/theme_win.py
Normal file
|
@ -0,0 +1,120 @@
|
|||
import ctypes
|
||||
|
||||
def get_system_color(index):
|
||||
return ctypes.windll.user32.GetSysColor(index)
|
||||
|
||||
def color_value_to_rgb(color_value):
|
||||
blue = color_value & 255
|
||||
green = (color_value >> 8) & 255
|
||||
red = (color_value >> 16) & 255
|
||||
return red, green, blue
|
||||
|
||||
def main():
|
||||
# System color indexes
|
||||
color_indexes = {
|
||||
1: "Scrollbar",
|
||||
2: "Background",
|
||||
3: "ActiveCaption",
|
||||
4: "InactiveCaption",
|
||||
5: "Menu",
|
||||
6: "Window",
|
||||
7: "WindowFrame",
|
||||
8: "MenuText",
|
||||
9: "WindowText",
|
||||
10: "CaptionText",
|
||||
11: "ActiveBorder",
|
||||
12: "InactiveBorder",
|
||||
13: "AppWorkspace",
|
||||
14: "Highlight",
|
||||
15: "HighlightText",
|
||||
16: "BtnFace",
|
||||
17: "BtnShadow",
|
||||
18: "GrayText",
|
||||
19: "BtnText",
|
||||
20: "InactiveCaptionText",
|
||||
21: "BtnHighlight",
|
||||
22: "3dDarkShadow",
|
||||
23: "3dLight",
|
||||
24: "InfoText",
|
||||
25: "InfoWindow",
|
||||
26: "HotLight",
|
||||
27: "GradientActiveCaption",
|
||||
28: "GradientInactiveCaption",
|
||||
29: "MenuHighlight",
|
||||
30: "MenuBar"
|
||||
}
|
||||
# Get and print system colors in RGB format
|
||||
for index, name in color_indexes.items():
|
||||
color_value = get_system_color(index)
|
||||
rgb_color = color_value_to_rgb(color_value)
|
||||
print(f"{name}: RGB{rgb_color}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
|
||||
# run 1
|
||||
# PS C:\msys64\home\Blazek_M\Launcher> python.exe .\src\theme_win.py
|
||||
# Scrollbar: RGB(0, 0, 0)
|
||||
# Background: RGB(209, 180, 153)
|
||||
# ActiveCaption: RGB(219, 205, 191)
|
||||
# InactiveCaption: RGB(240, 240, 240)
|
||||
# Menu: RGB(255, 255, 255)
|
||||
# Window: RGB(100, 100, 100)
|
||||
# WindowFrame: RGB(0, 0, 0)
|
||||
# MenuText: RGB(0, 0, 0)
|
||||
# WindowText: RGB(0, 0, 0)
|
||||
# CaptionText: RGB(180, 180, 180)
|
||||
# ActiveBorder: RGB(252, 247, 244)
|
||||
# InactiveBorder: RGB(171, 171, 171)
|
||||
# AppWorkspace: RGB(215, 120, 0)
|
||||
# Highlight: RGB(255, 255, 255)
|
||||
# HighlightText: RGB(240, 240, 240)
|
||||
# BtnFace: RGB(160, 160, 160)
|
||||
# BtnShadow: RGB(109, 109, 109)
|
||||
# GrayText: RGB(0, 0, 0)
|
||||
# BtnText: RGB(0, 0, 0)
|
||||
# InactiveCaptionText: RGB(255, 255, 255)
|
||||
# BtnHighlight: RGB(105, 105, 105)
|
||||
# 3dDarkShadow: RGB(227, 227, 227)
|
||||
# 3dLight: RGB(0, 0, 0)
|
||||
# InfoText: RGB(225, 255, 255)
|
||||
# InfoWindow: RGB(0, 0, 0)
|
||||
# HotLight: RGB(204, 102, 0)
|
||||
# GradientActiveCaption: RGB(234, 209, 185)
|
||||
# GradientInactiveCaption: RGB(242, 228, 215)
|
||||
# MenuHighlight: RGB(255, 153, 51)
|
||||
# MenuBar: RGB(240, 240, 240)
|
||||
|
||||
# run 2
|
||||
# PS C:\msys64\home\Blazek_M\Launcher> python.exe .\src\theme_win.py
|
||||
# Scrollbar: RGB(0, 0, 0)
|
||||
# Background: RGB(209, 180, 153)
|
||||
# ActiveCaption: RGB(219, 205, 191)
|
||||
# InactiveCaption: RGB(240, 240, 240)
|
||||
# Menu: RGB(255, 255, 255)
|
||||
# Window: RGB(100, 100, 100)
|
||||
# WindowFrame: RGB(0, 0, 0)
|
||||
# MenuText: RGB(0, 0, 0)
|
||||
# WindowText: RGB(0, 0, 0)
|
||||
# CaptionText: RGB(180, 180, 180)
|
||||
# ActiveBorder: RGB(252, 247, 244)
|
||||
# InactiveBorder: RGB(171, 171, 171)
|
||||
# AppWorkspace: RGB(215, 120, 0)
|
||||
# Highlight: RGB(255, 255, 255)
|
||||
# HighlightText: RGB(240, 240, 240)
|
||||
# BtnFace: RGB(160, 160, 160)
|
||||
# BtnShadow: RGB(109, 109, 109)
|
||||
# GrayText: RGB(0, 0, 0)
|
||||
# BtnText: RGB(0, 0, 0)
|
||||
# InactiveCaptionText: RGB(255, 255, 255)
|
||||
# BtnHighlight: RGB(105, 105, 105)
|
||||
# 3dDarkShadow: RGB(227, 227, 227)
|
||||
# 3dLight: RGB(0, 0, 0)
|
||||
# InfoText: RGB(225, 255, 255)
|
||||
# InfoWindow: RGB(0, 0, 0)
|
||||
# HotLight: RGB(204, 102, 0)
|
||||
# GradientActiveCaption: RGB(234, 209, 185)
|
||||
# GradientInactiveCaption: RGB(242, 228, 215)
|
||||
# MenuHighlight: RGB(255, 153, 51)
|
||||
# MenuBar: RGB(240, 240, 240)
|
Reference in a new issue