Blame Scripts/Functions/Render/render_getColors.sh

b47c3d
#!/bin/bash
b47c3d
#
b47c3d
# render_getColors.sh -- This function takes one palette produced by
b47c3d
# Gimp (e.g., syslinux.gpl) as input and outputs a list of colors as
b47c3d
# specified.
b47c3d
#
fa95b1
# Copyright (C) 2009-2011 Alain Reguera Delgado
fa95b1
#
fa95b1
# This program is free software; you can redistribute it and/or modify
fa95b1
# it under the terms of the GNU General Public License as published by
dcd347
# the Free Software Foundation; either version 2 of the License, or (at
dcd347
# your option) any later version.
b47c3d
#
74a058
# This program is distributed in the hope that it will be useful, but
74a058
# WITHOUT ANY WARRANTY; without even the implied warranty of
b47c3d
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
b47c3d
# General Public License for more details.
b47c3d
#
b47c3d
# You should have received a copy of the GNU General Public License
b47c3d
# along with this program; if not, write to the Free Software
dcd347
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
b47c3d
# ----------------------------------------------------------------------
b47c3d
# $Id$
b47c3d
# ----------------------------------------------------------------------
b47c3d
b47c3d
function render_getColors {
b47c3d
b47c3d
    # Define path to GPL palette. This is the .gpl file we use to
b47c3d
    # retrive color information from.
b47c3d
    local PALETTE_GPL="$1"
b47c3d
b47c3d
    # Retrive fourth column of information from GPL palette. The
b47c3d
    # fourth column of GPL palette contains the palette commentary
b47c3d
    # field. The palette commentary field can be anything, but for the
b47c3d
    # sake of our own convenience we use it to store the color
b47c3d
    # hexadecimal value.  Notice that you can put your comments from
b47c3d
    # the fifth column on.
b47c3d
    local COLORS=$(sed -r '1,/^#/d' $PALETTE_GPL | awk '{ printf "%s\n", $4 }')
b47c3d
b47c3d
    # Output list of colors. 
b47c3d
    echo "$COLORS"
b47c3d
 
b47c3d
}