scale .red -label Red -from 0 -to 255 -length 10c \
  -orient horizontal -command newColor
scale .green -label Green -from 0 -to 255 -length 10c \
  -orient horizontal -command newColor
scale .blue -label Blue -from 0 -to 255 -length 10c \
  -orient horizontal -command newColor
frame .sample -height 1.5c -width 6c
pack .red .green .blue -side top
pack .sample -side bottom -pady 2m
proc newColor value {
  set color [format "#%02x%02x%02x" [.red get] [.green get] [.blue get]]
  .sample config -background $color
}
