This file is indexed.

/usr/share/blt2.4/demos/scripts/xcolors.tcl is in blt-demo 2.4z-7ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
#
#!../bltwish
#
#  Tk version of xcolors
#

package require BLT
# --------------------------------------------------------------------------
# Starting with Tcl 8.x, the BLT commands are stored in their own 
# namespace called "blt".  The idea is to prevent name clashes with
# Tcl commands and variables from other packages, such as a "table"
# command in two different packages.  
#
# You can access the BLT commands in a couple of ways.  You can prefix
# all the BLT commands with the namespace qualifier "blt::"
#  
#    blt::graph .g
#    blt::table . .g -resize both
# 
# or you can import all the command into the global namespace.
#
#    namespace import blt::*
#    graph .g
#    table . .g -resize both
#
# --------------------------------------------------------------------------
if { $tcl_version >= 8.0 } {
    namespace import blt::*
    namespace import -force blt::tile::*
}
source scripts/demo.tcl
set numCols 0
set numRows 0
set maxCols 15
set cellWidth 40
set cellHeight 20
set numCells 0
set lastCount 0
set beginInput(0) 0
set map 0
set entryCount 0
set lastTagId {}

scrollbar .xscroll -command { .canvas xview } -orient horizontal
scrollbar .yscroll -command { .canvas yview }

label .sample \
    -font -*-new*century*schoolbook*-bold-r-*-*-24-*-*-*-*-*-*-* \
    -text {"Bisque is Beautiful".}

button .name -font -*-helvetica-medium-r-*-*-18-*-*-*-*-*-*-* \
    -command "AddSelection name"
button .rgb -font -*-courier-medium-r-*-*-18-*-*-*-*-*-*-* \
    -command "AddSelection rgb"

canvas .canvas \
    -confine 1 \
    -yscrollcommand { .yscroll set } \
    -width [expr 16*$cellWidth] -height 400  \
    -scrollregion [list 0 0 [expr 16*$cellWidth] 800]

frame .border -bd 2 -relief raised

label .status \
    -anchor w \
    -font -*-helvetica-medium-r-*-*-14-*-*-*-*-*-*-* 

button .quit -text "Quit" -command "exit"
button .next -text "Next" -command "DisplayColors next"
button .prev -text "Previous" -command "DisplayColors last"

selection handle .name GetColor
selection handle .rgb GetValue

bind .name <Enter> { 
    .status config -text \
	"Press button to write color name into primary selection"
}

bind .rgb <Enter> { 
    .status config -text \
	"Press button to write RGB value into primary selection"
}
bind .name <Leave> { 
    .status config -text ""
}

bind .rgb <Leave> { 
    .status config -text ""
}

bind .canvas <Enter> { 
    .status config -text \
	"Press button 1 to change background; Button 2 changes foreground"
}


table . \
    .sample 0,0 -cspan 2 -fill both -reqheight 1i \
    .name 1,0 -fill both -anchor w \
    .rgb 1,1 -fill both -anchor w \
    .canvas 2,0 -cspan 2 -fill both \
    .yscroll 2,2 -fill y \
    .border 3,0 -cspan 2 -fill x -reqheight 8 \
    .status 4,0 -cspan 2 -fill both  \
    .quit 4,1 -anchor e -reqwidth 1i -fill y -padx 10 -pady 4 \
    .prev 5,0 -anchor e -reqwidth 1i -fill y -padx 10 -pady 4 \
    .next 5,1 -anchor e -reqwidth 1i -fill y -padx 10 -pady 4 

proc AddSelection { what } {
    selection own .$what
    if {$what == "name" } {
	set mesg "Color name written into primary selection"
    } else {
	set mesg "RGB value written into primary selection"
    }
    .status config -text $mesg
}

proc GetColor { args } {
    return [lindex [.name config -text] 4]
}

proc GetValue { args } {
    return [lindex [.rgb config -text] 4]
}

proc ShowInfo { tagId what info } {
    global lastTagId

    if { $lastTagId != {} } {
	.canvas itemconfig $lastTagId -width 1
    }
    .canvas itemconfig $tagId -width 3
    set lastTagId $tagId

    set name [lindex $info 3]
    .name config -text $name 
    set value [format "#%0.2x%0.2x%0.2x" \
	       [lindex $info 0] [lindex $info 1] [lindex $info 2]]
    .rgb config -text $value
    .sample config $what $name
    .status config -bg $name
}


proc MakeCell { info } {
    global numCols numRows maxCols cellWidth cellHeight numCells 

    set x [expr $numCols*$cellWidth]
    set y [expr $numRows*$cellHeight]
    set color [lindex $info 3]

    if [catch {winfo rgb . $color}] {
	return "ok"
    }
#    if { [tk colormodel .] != "color" } {
#	bind . <Leave> { 
#	    .status config -text "Color table full after $numCells entries."
#	}
#	.status config -text "Color table full after $numCells entries."
#	return "out of colors"
#    }
    set id [.canvas create rectangle \
	    $x $y [expr $x+$cellWidth] [expr $y+$cellHeight] \
		-fill $color -outline black]
    if { $color == "white" } {
	global whiteTagId
	set whiteTagId $id
    }

    .canvas bind $id <1> [list ShowInfo $id -bg $info]
    .canvas bind $id <2> [list ShowInfo $id -fg $info]
    
    incr numCols
    if { $numCols > $maxCols } {
	set numCols 0
	incr numRows
    }
    return "ok"
}

proc DisplayColors { how } {
    global lastCount numCells cellHeight numRows numCols rgbText 
    global map beginInput
    
#    tk colormodel . color
    set initialized no

    if { $how == "last" } {
	if { $map == 0 } {
	    return
	}
	set map [expr $map-1]
    } else {
	incr map
	if ![info exists beginInput($map)] {
	    set beginInput($map) $lastCount
	}
    }

    set start $beginInput($map)

    if { $numCells > 0 } {
	.canvas delete all
	set numRows 0
	set numCols 0
	set initialized yes
    }

    set input [lrange $rgbText $start end]
    set lineCount $start
    set entryCount 0
    foreach i $input {
	incr lineCount
	if { [llength $i] == 4 } {
	    if { [MakeCell $i] == "out of colors"  } {
		break
	    }
	    incr entryCount
	}
    }
    if { $entryCount == 0 } {
	bind . <Leave> { 
	    .status config -text "No more entries in RGB database"
	}
	.status config -text "No more entries in RGB database"
    } 
    set lastCount $lineCount
    proc tkerror {args} { 
	#dummy procedure
    }

    if { $initialized == "no" } {
	global cellWidth

	set height [expr $cellHeight*($numRows+1)]
	.canvas config -scrollregion [list 0 0 [expr 16*$cellWidth] $height]
	if { $height < 800 } {
	    .canvas config -height $height
	}
	global whiteTagId
	if [info exists whiteTagId] {
	    ShowInfo $whiteTagId -bg {255 255 255 white}
	}
    }
    update idletasks
    update
    rename tkerror {}
}

wm min . 0 0

foreach location {
	/usr/X11R6
	/util/X11R6
	/usr/openwin
	/usr/dt
} {
    set file [file join $location lib X11 rgb.txt]
    if { [file exists $file] } {
       break
    }
}
set in [open $file "r"]
set rgbText [read $in]
close $in
set rgbText [split $rgbText \n]
DisplayColors next
wm min . 0 0