]> git.zerfleddert.de Git - micropolis/blame - src/tk/library/demos/color
Import Micropolis from http://www.donhopkins.com/home/micropolis/
[micropolis] / src / tk / library / demos / color
CommitLineData
6a5fa4e0
MG
1#!/usr/local/bin/wish -f
2#
3# Simple script to change colors of a window.
4
5if "$argc < 3" {error "Usage: color appName window option"}
6set appName [lindex $argv 0]
7set widget [lindex $argv 1]
8set option [lindex $argv 2]
9set red 0
10set green 0
11set blue 0
12
13option add *Scale.sliderForeground "#cdb79e"
14option add *Scale.activeForeground "#ffe4c4"
15pack append . [scale .red -command "color red" -label "Red Intensity" \
16 -from 0 -to 255 -orient horizontal -bg "#ffaeb9" -length 250] \
17 {top expand fill}
18pack append . [scale .green -command "color green" -label "Green Intensity" \
19 -from 0 -to 255 -orient horizontal -bg "#43cd80"] {top expand fill}
20pack append . [scale .blue -command "color blue" -label "Blue Intensity" \
21 -from 0 -to 255 -orient horizontal -bg "#7ec0ee"] {top expand fill}
22
23proc color {which intensity} {
24 global red green blue appName widget option
25 set $which $intensity
26 send $appName $widget config $option \
27 [format #%02x%02x%02x $red $green $blue]
28}
29
30bind . <Control-q> {destroy .}
31bind . <Control-c> {destroy .}
32focus .
Impressum, Datenschutz