Color Chooser

Tony's Wiki

color chooser

This is a simple color chooser in tcl/tk.
Editing a css sheet on a remote server, and need a color code?
This tool is your friend.

color chooser color chooser

#!/usr/bin/env wish8.5
# a quick color chooser tool
# tony baldwin |
bind . <Escape> {exit}
wm title . "Tk Color Chooser"
    global wbg
    set wbg "none"
frame .c -bd 5 -relief raised
grid [ttk::label .c.lbl -text "Tony's Tickles"]\
[ttk::label .c.lbl2 -text "Color Chooser"]
grid [ttk::label .c.lbl3 -text "You chose:"]\
[ttk::entry .c.ent -textvariable ::wbg]
grid [ttk::button -text "Color Chooser" -command {cc}]\
[ttk::button .c.out -text "QUIT" -command {exit}]
pack .c -in . -fill x
# tk_chooseColor
proc cc {} {
    set ::wbg [tk_chooseColor]
    if {$::wbg != ""} {tk_setPalette background $::wbg}
# This program was written by tony baldwin | 
# This program is free software; you can redistribute it and/or modify 
# it under the terms of the GNU General Public License as published by 
# the Free Software Foundation; either version 2 of the License, or 
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

As you can see, the majority of the work was already done by the nice folks who develop tcl/tk. My script simply calls the colorchooser that's built in, allows you to pick a color, and then gives you the hex code to copy/paste where ever desired.

Download a tarball with the script and an script, license and readme here:


tonybaldwin 2012.