A simple module for getting Windows' accent color
Project description
winaccent
A simple and lightweight Python module for getting Windows' accent color or a shade of it. Works on both Windows 10 and 11 and doesn't require additional dependencies.
📦 Installation
Run this command in your terminal:
pip install winaccent
📜 Documentation
Get a specific accent color
For simplicity, you can get a specific accent color from one of the following variables:
Variable | Color | Preview |
---|---|---|
accent_dark_mode | #4CC2FF | |
accent_normal | #0078D4 | |
accent_light_mode | #0067C0 |
If you need a different shade, you can get it from one of these variables:
Variable | Color | Preview |
---|---|---|
accent_light_3 | #99EBFF | |
accent_light_2 | #4CC2FF | |
accent_light_1 | #0091F8 | |
accent_normal | #0078D4 | |
accent_dark_1 | #0067C0 | |
accent_dark_2 | #003E92 | |
accent_dark_3 | #001A68 |
[!NOTE] The color previews shown here are for the Windows 11's default accent color (blue).
[!TIP]
accent_dark_mode
is the same thing asaccent_light
which is the same thing asaccent_light_2
. Also,accent_light_mode
is the same thing asaccent_dark
which is the same thing asaccent_dark_1
.
Example:
import winaccent
print(winaccent.accent_light_mode) # Prints the light mode accent color
Here is a link for the guidelines (Microsoft Learn):
https://learn.microsoft.com/en-us/windows/apps/design/style/color#accent-color-palette
Update accent colors
The accent colors can be updated manually using the update_accent_colors()
function. This function will retrieve the values again.
Accent color change listener
This module allows you to add a listener that will call a specific function when the accent color changes. Here's how you can add it:
import winaccent, threading
# Replace `callback` with the function that you want to be called
thread = threading.Thread(target = lambda: winaccent.on_accent_changed_listener(callback), daemon = True)
thread.start()
[!NOTE] If you added the listener, there's no need to call
update_accent_colors()
because it will be called automatically every time the accent color changes.
Here's a demo:
💻 Demo
To see a demo, run the following command in your terminal:
python -m winaccent
Here's a demo with 3 different accent colors:
Blue | Green | Red |
---|---|---|
🤩 Feedback
If you found a bug or want to make a suggestion, open a new issue. If you're ready to add a new feature or fix a bug, pull requests are welcome.
If you find this module useful, you can consider starring this repository.
📋 To do
-
Add an accent color change listener
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file winaccent-1.0.0.tar.gz
.
File metadata
- Download URL: winaccent-1.0.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6cefd4c3dcd033c6ac01b06c41ff7091186f348f53dbe44f14e6a119677e129 |
|
MD5 | 923879cf77ac031a8282b87ed6b3475d |
|
BLAKE2b-256 | d222c192b9b7f2915e6a63ef0a8f1e4787fe3acc9dfb6e2224d297ea81b20e30 |
Provenance
File details
Details for the file winaccent-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: winaccent-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cf6238cde6ed4b103265eb249ba0e3d6cd12df9dbeb4c2039270256ce859a65 |
|
MD5 | 8694d1240aa425c169357b608c84acdf |
|
BLAKE2b-256 | 99224d72e6ce44cd57dcc1a993dd48ba0b00bf2c4ef62787490fc3928c822fbb |