|
|
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 |
#
|
|
|
b47c3d |
# Copyright 2009-2011 Alain Reguera Delgado
|
|
|
b47c3d |
#
|
|
|
b47c3d |
# This program is free software; you can redistribute it and/or
|
|
|
b47c3d |
# modify it under the terms of the GNU General Public License as
|
|
|
b47c3d |
# published by the Free Software Foundation; either version 2 of the
|
|
|
b47c3d |
# License, or (at your option) any later version.
|
|
|
b47c3d |
#
|
|
|
b47c3d |
# This program is distributed in the hope that it will be useful, but
|
|
|
b47c3d |
# 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
|
|
|
b47c3d |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
b47c3d |
# USA.
|
|
|
b47c3d |
#
|
|
|
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 |
}
|