tkColorPicker icon indicating copy to clipboard operation
tkColorPicker copied to clipboard

add optional custom colorpalettes to askcolor

Open dende opened this issue 4 years ago • 1 comments

Hi, first of all thanks for the package! I'm using it to create a portable application that offers the same colorpicking UX on windows and on linux, because the windows colorpicker is not customizable.

In my example, I'm, using a colorpicker to select colors for plots that I draw with matplotlib. For these plots, I want to be using a palette of predefined colors that work good on charts. Such palettes could be found at ColorBrewer, for example.

With this commit you could easily use palettes like this:

# taken from https://colorbrewer2.org/#type=diverging&scheme=RdYlBu&n=11
custom_palette = ["#a50026", "#d73027", "#f46d43", "#fdae61", "#fee090", "#ffffbf", "#e0f3f8", "#abd9e9", "#74add1",
                  "#4575b4", "#313695"]

print(askcolor((255, 255, 0), root, palette=custom_palette))

Screenshot 2021-08-06 230431

dende avatar Aug 06 '21 21:08 dende

Codecov Report

Merging #7 (f711c60) into master (407fe0e) will increase coverage by 0.16%. The diff coverage is 75.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #7      +/-   ##
==========================================
+ Coverage   99.28%   99.44%   +0.16%     
==========================================
  Files           9        9              
  Lines        1265     1270       +5     
==========================================
+ Hits         1256     1263       +7     
+ Misses          9        7       -2     
Impacted Files Coverage Δ
tkcolorpicker/colorpicker.py 98.52% <75.00%> (-0.48%) :arrow_down:
tests.py 99.78% <0.00%> (+0.42%) :arrow_up:
tkcolorpicker/functions.py 100.00% <0.00%> (+3.50%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 407fe0e...f711c60. Read the comment docs.

codecov[bot] avatar Aug 06 '21 21:08 codecov[bot]