perl -MTk -e "print $Tk::VERSION" #### sub butone { my $color = $diswindow->chooseColor( -initialcolor => $colour, -title => 'Choose color' ); if ($color) { $colour = $color; my ( $r, $g, $b ) = $colour =~ /\w{2}/g; for ( $r, $g, $b ) { $_ = hex $_; } my $foreground = ( $r + $g + $b < 400 ) ? '#ffffff' : '#000000'; change_colors( $diswindow, $colour, $foreground ); } } sub change_colors { my ( $widget, $color, $fg ) = @_; $widget->configure( -bg => $color ); { no warnings 'uninitialized'; eval( $widget->configure( -foreground => $fg ) ); } if ( my @children = $widget->children ) { change_colors( $_, $color, $fg ) for @children; } }