File: make-colors

package info (click to toggle)
rosegarden 1%3A25.12-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 42,888 kB
  • sloc: cpp: 209,189; xml: 6,580; sh: 1,608; perl: 755; python: 416; ansic: 324; lisp: 139; ruby: 33; makefile: 20
file content (63 lines) | stat: -rwxr-xr-x 1,612 bytes parent folder | download | duplicates (10)
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
#!/bin/bash
#
# Copyright (c) 2005  D. Michael McIntyre <dmmcintyr@users.sourceforge.net>
# Released under the GPL
#
# make-colors
#
# little hacky script to make colors for autoload.rg
#
# takes scripts/color-list as input (which was originally created from the
# output of a showrgb command, pared down to eliminate duplicate numerical
# entries and colors that were so close to white they were probably useless)
#
# the first entry in color-list is the default "Rosegarden green" color
# the second entry is the default audio segment color
# the remaining entries can be changed at will.
#
# format of color-list is:
# R,G,B,ColorName
#
# No spaces!  This crappy bash script uses cut to parse the file, and spaces
# will break it.
#
# the results are written to gui/testfiles/colourmap-fragment.xml file which can be
# manually imported into autoload.rg or any other .rg file
#
#

CVS=~/CVS

ifile=$CVS/rosegarden/scripts/color-list
ofile=$CVS/rosegarden/gui/testfiles/colourmap-fragment.xml

[ -f $ofile ]&&rm -f $ofile
   
# write block header
cat << EOF >> $ofile
        <colourmap name="segmentmap">
EOF

ID=0
for f in `cat $ifile`; do
    r=`echo $f|cut -d , -f 1`
    g=`echo $f|cut -d , -f 2`
    b=`echo $f|cut -d , -f 3`
    name=`echo $f|cut -d , -f 4`
    
    #special override to void name for first entry, which should be ""
    [ $ID == 0 ] && name=
    cat << EOF >> $ofile
	    <colourpair id="$ID" name="$name" red="$r" green="$g" blue="$b"/>
EOF
    ((ID++))
done

# write block close
cat << EOF >> $ofile
        </colourmap>
EOF

echo Done...  Reminder, output went to $ofile...

exit 0