19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
proc icon {type name {x 5px} {y 2px} {width 16px} {height 16px}} {
set file [iconfile $type $name]
set fd [open $file]
set data [read $fd]
close $fd
puts -nonewline [string map [list @@XPOS@@ $x @@YPOS@@ $y @@WIDTH@@ $width @@HEIGHT@@ $height] $data]
}
proc textColorFromBackground {color} {
return "#fff"
}
set args(background_color) "#eee"
|
|
|
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
proc icon {type name {x 5px} {y 2px} {width 16px} {height 16px}} {
set file [iconfile $type $name]
set fd [open $file]
set data [read $fd]
close $fd
return [string map [list @@XPOS@@ $x @@YPOS@@ $y @@WIDTH@@ $width @@HEIGHT@@ $height] $data]
}
proc textColorFromBackground {color} {
return "#fff"
}
set args(background_color) "#eee"
|
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
|
headers type image/svg+xml
headers add Last-Modified $timestamp
headers add ETag $etag
set q [format %c 63]
puts -nonewline "<${q}xml version=\"1.0\"${q}>"
?>
<svg xmlns="http://www.w3.org/2000/svg" width="120" height="20">
<linearGradient id="a" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<rect rx="3" width="120" height="20" fill="<? puts -nonewline $args(background_color) ?>"/>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<? if {[info exists args(no_action_icon)] || [catch {icon action $args(action) 36}]} { ?>
<rect rx="3" width="120" height="20" fill="<? puts -nonewline $args(action_color) ?>"/>
<text x="44" y="15" fill="#010101" fill-opacity=".3"><? puts -nonewline $args(action) ?></text>
<text x="44" y="14" fill="<? puts -nonewline $actionTextColor ?>"><? puts -nonewline $args(action) ?></text>
<? } ?>
<? if {[info exists args(no_status_icon)] || [catch {icon status $args(status) 84}]} { ?>
<rect rx="3" x="65" width="55" height="20" fill="<? puts -nonewline $args(status_color) ?>"/>
<text x="92" y="15" fill="#010101" fill-opacity=".3"><? puts -nonewline $args(status) ?></text>
<text x="92" y="14" fill="<? puts -nonewline $statusTextColor ?>"><? puts -nonewline $args(status) ?></text>
<? } ?>
<rect rx="3" width="120" height="20" fill="url(#a)"/>
<? catch {icon os $args(os)} ?>
</g>
<!-- <? #puts $errList ?> -->
</svg>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
>
>
>
|
|
>
>
>
>
|
|
|
|
|
|
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
|
headers type image/svg+xml
headers add Last-Modified $timestamp
headers add ETag $etag
set q [format %c 63]
puts -nonewline "<${q}xml version=\"1.0\"${q}>"
if {![info exists args(no_action_icon)]} {
catch {
set actionIcon [icon action $args(action) 24]
}
}
if {[info exists actionIcon]} {
set actionAreaWidth 18
} else {
set actionAreaWidth 45
}
if {![info exists args(no_status_icon)]} {
catch {
set statusIcon [icon status $args(status) [expr {20 + $actionAreaWidth}]]
}
}
if {[info exists statusIcon]} {
set statusAreaWidth 18
} else {
set statusAreaWidth 55
}
set osAreaWidth 20
set totalWidth [expr {$osAreaWidth + $actionAreaWidth + $statusAreaWidth}]
?>
<svg xmlns="http://www.w3.org/2000/svg" width="<? puts -nonewline $totalWidth ?>" height="20">
<linearGradient id="a" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<rect rx="3" width="<? puts -nonewline $totalWidth ?>" height="20" fill="<? puts -nonewline $args(background_color) ?>"/>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<? if {[info exists actionIcon]} {
puts -nonewline $actionIcon
} else {
?>
<rect rx="3" width="<? puts -nonewline $totalWidth ?>" height="20" fill="<? puts -nonewline $args(action_color) ?>"/>
<text x="44" y="15" fill="#010101" fill-opacity=".3"><? puts -nonewline $args(action) ?></text>
<text x="44" y="14" fill="<? puts -nonewline $actionTextColor ?>"><? puts -nonewline $args(action) ?></text>
<? } ?>
<? if {[info exists statusIcon]} {
puts -nonewline $statusIcon
} else {
set statusTextLocation [expr {$osAreaWidth + $actionAreaWidth + ($statusAreaWidth / 2)}]
?>
<rect rx="3" x="<? puts -nonewline [expr {$totalWidth - $statusAreaWidth}] ?>" width="<? puts -nonewline $statusAreaWidth ?>" height="20" fill="<? puts -nonewline $args(status_color) ?>"/>
<text x="<? puts -nonewline $statusTextLocation ?>" y="15" fill="#010101" fill-opacity=".3"><? puts -nonewline $args(status) ?></text>
<text x="<? puts -nonewline $statusTextLocation ?>" y="14" fill="<? puts -nonewline $statusTextColor ?>"><? puts -nonewline $args(status) ?></text>
<? } ?>
<rect rx="3" width="<? puts -nonewline $totalWidth ?>" height="20" fill="url(#a)"/>
<? catch {puts -nonewline [icon os $args(os)]} ?>
</g>
<!-- <? #puts $errList ?> -->
</svg>
|