GTKDIALOG - Make a colored button widget with a simple script
SVG Color Names. There are the 147 color names defined by the Scalable Vector Graphics (SVG) Specification.
You may set named colors like this: stroke="Green" or fill="Red".
Here is the official list of colors available for SVG images
https://www.w3.org/TR/SVG11/types.html#ColorKeywords
Tutorial-
Let's make buttons that have rounded corners and are colored .
Just run this script. It generates an SVG image that can be found in /tmp folder.
There are three variables --> FILL TEXT FONTSIZE
but other changes are possible like stroke width and opacity
Code: Select all
#! /bin/sh
FILL=white
TEXT="MY TEXT"
FONTSIZE=15
X1=$(echo "$TEXT"|wc -c) # number of letters
W=$((${X1}*${FONTSIZE}*6*95/31/20)) # width
DISPLACE=$(($W/6+5)) # vertical value
echo '<svg version="1.1">
<rect
style="fill:'$FILL';fill-opacity:.7;stroke-width:2;stroke:black;stroke-opacity:1;"
width='\"$W\"' height="36" rx="10" ry="10" x="1" y="1"/>
<text style="font-family:DejaVu;font-size:'"$FONTSIZE"';fill-opacity:1"
x='\"$DISPLACE\"' y="25" >
'$TEXT'
</text>
</svg>
'>/tmp/SVG_"$TEXT".svg
You can make a clickable button using the SVG image.
Run this script in terminal.
Code: Select all
#! /bin/sh
export MY_SCRIPT='
<window>
<button>
<input file>"'"/tmp/SVG_MY TEXT.svg"'"</input>
<action>gxmessage here </action>
</button>
</window>'
gtkdialog -p MY_SCRIPT -c
exit 0
______________________________________________________
Here's an example of a white button...
Note : FONTSIZE can be anywhere from 10 to 30
and a large amount of text inside of the button is possible.