%global _empty_manifest_terminate_build 0 Name: python-darkdetect Version: 0.8.0 Release: 1 Summary: Detect OS Dark Mode from Python License: BSD-3-Clause URL: https://pypi.org/project/darkdetect/ Source0: https://mirrors.aliyun.com/pypi/web/packages/45/77/7575be73bf12dee231d0c6e60ce7fb7a7be4fcd58823374fc59a6e48262e/darkdetect-0.8.0.tar.gz BuildArch: noarch Requires: python3-pyobjc-framework-Cocoa %description # Darkdetect This package allows to detect if the user is using Dark Mode on: - [macOS 10.14+](https://support.apple.com/en-us/HT208976) - [Windows 10 1607+](https://blogs.windows.com/windowsexperience/2016/08/08/windows-10-tip-personalize-your-pc-by-enabling-the-dark-theme/) - Linux with [a dark GTK theme](https://www.gnome-look.org/browse/cat/135/ord/rating/?tag=dark). The main application of this package is to detect the Dark mode from your GUI Python application (Tkinter/wx/pyqt/qt for python (pyside)/...) and apply the needed adjustments to your interface. Darkdetect is particularly useful if your GUI library **does not** provide a public API for this detection (I am looking at you, Qt). In addition, this package does not depend on other modules or packages that are not already included in standard Python distributions. ## Usage ``` import darkdetect >>> darkdetect.theme() 'Dark' >>> darkdetect.isDark() True >>> darkdetect.isLight() False ``` It's that easy. You can create a dark mode switch listener daemon thread with `darkdetect.listener` and pass a callback function. The function will be called with string "Dark" or "Light" when the OS switches the dark mode setting. ``` python import threading import darkdetect # def listener(callback: typing.Callable[[str], None]) -> None: ... t = threading.Thread(target=darkdetect.listener, args=(print,)) t.daemon = True t.start() ``` ## Install The preferred channel is PyPI: ``` pip install darkdetect ``` Alternatively, you are free to vendor directly a copy of Darkdetect in your app. Further information on vendoring can be found [here](https://medium.com/underdog-io-engineering/vendoring-python-dependencies-with-pip-b9eb6078b9c0). ## Optional Installs To enable the macOS listener, additional components are required, these can be installed via: ```bash pip install darkdetect[macos-listener] ``` ## Notes - This software is licensed under the terms of the 3-clause BSD License. - This package can be installed on any operative system, but it will always return `None` unless executed on a OS that supports Dark Mode, including older versions of macOS and Windows. - On macOS, detection of the dark menu bar and dock option (available from macOS 10.10) is not supported. - [Details](https://stackoverflow.com/questions/25207077/how-to-detect-if-os-x-is-in-dark-mode) on the detection method used on macOS. - [Details](https://askubuntu.com/questions/1261366/detecting-dark-mode#comment2132694_1261366) on the experimental detection method used on Linux. %package -n python3-darkdetect Summary: Detect OS Dark Mode from Python Provides: python-darkdetect BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-darkdetect # Darkdetect This package allows to detect if the user is using Dark Mode on: - [macOS 10.14+](https://support.apple.com/en-us/HT208976) - [Windows 10 1607+](https://blogs.windows.com/windowsexperience/2016/08/08/windows-10-tip-personalize-your-pc-by-enabling-the-dark-theme/) - Linux with [a dark GTK theme](https://www.gnome-look.org/browse/cat/135/ord/rating/?tag=dark). The main application of this package is to detect the Dark mode from your GUI Python application (Tkinter/wx/pyqt/qt for python (pyside)/...) and apply the needed adjustments to your interface. Darkdetect is particularly useful if your GUI library **does not** provide a public API for this detection (I am looking at you, Qt). In addition, this package does not depend on other modules or packages that are not already included in standard Python distributions. ## Usage ``` import darkdetect >>> darkdetect.theme() 'Dark' >>> darkdetect.isDark() True >>> darkdetect.isLight() False ``` It's that easy. You can create a dark mode switch listener daemon thread with `darkdetect.listener` and pass a callback function. The function will be called with string "Dark" or "Light" when the OS switches the dark mode setting. ``` python import threading import darkdetect # def listener(callback: typing.Callable[[str], None]) -> None: ... t = threading.Thread(target=darkdetect.listener, args=(print,)) t.daemon = True t.start() ``` ## Install The preferred channel is PyPI: ``` pip install darkdetect ``` Alternatively, you are free to vendor directly a copy of Darkdetect in your app. Further information on vendoring can be found [here](https://medium.com/underdog-io-engineering/vendoring-python-dependencies-with-pip-b9eb6078b9c0). ## Optional Installs To enable the macOS listener, additional components are required, these can be installed via: ```bash pip install darkdetect[macos-listener] ``` ## Notes - This software is licensed under the terms of the 3-clause BSD License. - This package can be installed on any operative system, but it will always return `None` unless executed on a OS that supports Dark Mode, including older versions of macOS and Windows. - On macOS, detection of the dark menu bar and dock option (available from macOS 10.10) is not supported. - [Details](https://stackoverflow.com/questions/25207077/how-to-detect-if-os-x-is-in-dark-mode) on the detection method used on macOS. - [Details](https://askubuntu.com/questions/1261366/detecting-dark-mode#comment2132694_1261366) on the experimental detection method used on Linux. %package help Summary: Development documents and examples for darkdetect Provides: python3-darkdetect-doc %description help # Darkdetect This package allows to detect if the user is using Dark Mode on: - [macOS 10.14+](https://support.apple.com/en-us/HT208976) - [Windows 10 1607+](https://blogs.windows.com/windowsexperience/2016/08/08/windows-10-tip-personalize-your-pc-by-enabling-the-dark-theme/) - Linux with [a dark GTK theme](https://www.gnome-look.org/browse/cat/135/ord/rating/?tag=dark). The main application of this package is to detect the Dark mode from your GUI Python application (Tkinter/wx/pyqt/qt for python (pyside)/...) and apply the needed adjustments to your interface. Darkdetect is particularly useful if your GUI library **does not** provide a public API for this detection (I am looking at you, Qt). In addition, this package does not depend on other modules or packages that are not already included in standard Python distributions. ## Usage ``` import darkdetect >>> darkdetect.theme() 'Dark' >>> darkdetect.isDark() True >>> darkdetect.isLight() False ``` It's that easy. You can create a dark mode switch listener daemon thread with `darkdetect.listener` and pass a callback function. The function will be called with string "Dark" or "Light" when the OS switches the dark mode setting. ``` python import threading import darkdetect # def listener(callback: typing.Callable[[str], None]) -> None: ... t = threading.Thread(target=darkdetect.listener, args=(print,)) t.daemon = True t.start() ``` ## Install The preferred channel is PyPI: ``` pip install darkdetect ``` Alternatively, you are free to vendor directly a copy of Darkdetect in your app. Further information on vendoring can be found [here](https://medium.com/underdog-io-engineering/vendoring-python-dependencies-with-pip-b9eb6078b9c0). ## Optional Installs To enable the macOS listener, additional components are required, these can be installed via: ```bash pip install darkdetect[macos-listener] ``` ## Notes - This software is licensed under the terms of the 3-clause BSD License. - This package can be installed on any operative system, but it will always return `None` unless executed on a OS that supports Dark Mode, including older versions of macOS and Windows. - On macOS, detection of the dark menu bar and dock option (available from macOS 10.10) is not supported. - [Details](https://stackoverflow.com/questions/25207077/how-to-detect-if-os-x-is-in-dark-mode) on the detection method used on macOS. - [Details](https://askubuntu.com/questions/1261366/detecting-dark-mode#comment2132694_1261366) on the experimental detection method used on Linux. %prep %autosetup -n darkdetect-0.8.0 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-darkdetect -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Thu Jun 08 2023 Python_Bot - 0.8.0-1 - Package Spec generated