Skip to main content

Photoshop-style color picker for CustomTkinter — sat/val square, HSL lightness slider, hue slider, hex input, tint strip, and persistent saved colors

Project description

ctk-color-picker

PyPI Python License: MIT

A modern, Photoshop-style color picker dialog for CustomTkinter. One function call, one hex string back.

Pure Python + Pillow. DPI-aware. Modal dialog. Works on Windows, macOS, Linux.

Color picker dialog

Color picker in action


Features

  • 🎨 Saturation × Value square (drag to pick)
  • 💡 HSL Lightness slider (black → color → white)
  • 🌈 Hue slider
  • 🔤 Hex input field
  • 👀 Old / New comparison swatches
  • 🎭 Tint strip — 13 dynamic variations of the current color
  • 💾 Saved Colors — 20 slots, persistent across sessions (JSON)
  • ⭐ Selection highlight on saved swatch matching current pick
  • 🖥️ DPI-aware tk.Canvas — matches CTk widget scaling

Requirements

Python 3.10+
customtkinter 5.2.2+
Pillow 10.0.0+

tkinter ships with Python on Windows/macOS. On Linux: sudo apt install python3-tk.

Install

pip install ctk-tint-color-picker

Or from source for development:

git clone https://github.com/kandelucky/ctk-color-picker.git
cd ctk-color-picker
pip install -e .

Quick start

import customtkinter as ctk
from ctk_color_picker import askcolor

ctk.set_appearance_mode("dark")
app = ctk.CTk()
app.geometry("300x200")

def on_pick():
    color = askcolor(app, initial="#1f6aa5")
    if color:
        button.configure(fg_color=color)

button = ctk.CTkButton(app, text="Pick a color", command=on_pick)
button.pack(expand=True, padx=20, pady=20)
app.mainloop()

askcolor() opens the modal dialog, blocks until closed, and returns a hex string or None if cancelled.

Picker integrated with an app


API

askcolor(master, initial="#1f6aa5", history=None, title="Color Picker") -> str | None

Convenience function. Opens the dialog modally and returns the picked hex.

ColorPickerDialog(master, initial_color="#1f6aa5", history=None, title="Color Picker")

The dialog class. Use directly when you need more control:

dialog = ColorPickerDialog(parent, initial_color="#ff0000")
dialog.wait_window()
print(dialog.result)   # hex string or None

ColorHistory(path=None, max_entries=20)

Manages persistent saved colors as a JSON file. Default path is ~/.ctk_color_picker/colors.json. Pass to the dialog for custom storage.

palette = ColorHistory(path="./project_palette.json", max_entries=30)
color = askcolor(app, history=palette)

Methods: .add(hex), .all(), .clear().


When to use this

Reach for ctk-color-picker when you want:

  • A themed picker that matches the rest of your CustomTkinter app
  • Saturation × value picking plus a separate HSL lightness control
  • A tint strip of the current color for quick shade tweaks
  • A persistent saved-colors palette shared across sessions
  • A screen eyedropper that samples any pixel with a single click
  • DPI-aware rendering on high-resolution Windows displays

Reach for tkinter.colorchooser instead if you just need the OS native dialog with zero setup and no extra dependencies.


Troubleshooting

ModuleNotFoundError: No module named 'ctk_color_picker' — run pip install -e . from the repo root, or copy the ctk_color_picker/ folder next to your script.

Dialog tiny / blurry on a 4K display — make sure customtkinter ≥ 5.2.2.

Saved colors don't persist — check that ~/.ctk_color_picker/ is writable.


License

MIT © 2026 kandelucky

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

ctk_tint_color_picker-0.3.2.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ctk_tint_color_picker-0.3.2-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file ctk_tint_color_picker-0.3.2.tar.gz.

File metadata

  • Download URL: ctk_tint_color_picker-0.3.2.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for ctk_tint_color_picker-0.3.2.tar.gz
Algorithm Hash digest
SHA256 6cbb7dd48647f810ab9fec8d38f8bab719fec78f6cd0e34ff16da1265bb8a4be
MD5 9a0438c685fa0854bb652b94b53333f1
BLAKE2b-256 7f6c11047fd2f26149429cc7b5a8173d8625f9ad1f749823b2f0eaf74030da11

See more details on using hashes here.

File details

Details for the file ctk_tint_color_picker-0.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for ctk_tint_color_picker-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 da74d306d1508c89a98892c048b92f92bac5184d017637232605d36123e61c9e
MD5 a31da93a180a89e6cf2ebfb13e534ce7
BLAKE2b-256 1ebd3a74fceedb359f4f2e00b87f282e653df62161d009bfba7306c3988fb677

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page