Bwidget Source Code
View Ticket
Not logged in
Ticket UUID: 4f9a4205f0009ada674af7c87398d59707bd298
Title: color selection dialog accepts named tk colors
Type: Patch Version: .1
Submitter: anonymous Created on: 2024-08-16 08:43:53
Subsystem: bwidget 1.x Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2024-08-26 08:17:54
Resolution: Accepted Closed By: oehhar
    Closed on: 2024-08-26 08:17:54
Description:
Hi, 
Below is a link to my version of bwidgets color.tcl.
It allows named tk colors to be input into the Bwidget color selection dialog.
Perhaps it'll be useful. I've tried to handle errors, but perhaps there are things i've overlooked.
Cheers, Steven
https://sourceforge.net/projects/scidvspc/files/support%20files/bwidget_custom_color.tcl.gz/download
User Comments: oehhar added on 2024-08-26 08:17:54:

Alternate solution merged with commit [b0d8a1c23c]. RFE closed. Thanks for all, Harald


oehhar added on 2024-08-21 16:22:03:

Thank you for the observation and the patch:

proc SelectColor::_set_hue_sat {hue sat} {
     variable _widget
+    variable _hsv
 
+    set _hsv [lreplace $_hsv 0 1 $hue $sat]
     set x [expr {$hue*200-9}]
     set y [expr {(1-$sat)*200-9}]
     $_widget(chs) coords target $x $y
     _draw_values $hue $sat
}

Please allow me to propose an alternate solution in commit [8acfd06d90]. This bug is also present in the main widget. It was fixed there. Thanks for the bug report.

Thank you, Harald


anonymous added on 2024-08-20 08:52:54:
Your solution seems very nice, cheers. But i can see a hiccup which i   fixed in my version.  To reproduce, open color dialog, type in a new color (eg red), then slide the far-right gradient slider. The colored box is not correct. Attached below is my hack/fix. Cheers, Steven

oehhar added on 2024-08-19 11:49:42:

Hi Steven, thank you for the contribution.

It is now in branch [4f9a4205-named-colors] starting with commit [2605c8c3e2].

We need some fine tuning. Will come up with a version to test.

Thanks again, Harald


oehhar added on 2024-08-19 11:49:14:

Hi Steven,

would the solution in commit [9616d6dea2] of branch [4f9a4205-named-colors-alt] also fit your needs?

It works a bit like an alternate input method. If you enter "red" or "#abc" and press tab, you get the #rrggbb version in the input field. The application always gets #rrggbb back.

To conserve the color name, we would need more work.

Thank you for all, Harald


oehhar added on 2024-08-19 10:11:36:
Hi Steven,
thank you for the contribution.

It is now in branch [4f9a4205-named-colors] starting with commit [2605c8c3e2].

We need some fine tuning. Will come up with a version to test.

Thanks again,
Harald

Attachments: