Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't require xcolor to run the canvas program #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions canvas
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ reset_color() {

## Prerequisite
Prerequisite() {
dependencies=(convert feh xcolor)
dependencies=(convert feh)
for dependency in "${dependencies[@]}"; do
type -p "$dependency" &>/dev/null || {
echo -e ${RED}"ERROR: Could not find ${GREEN}'${dependency}'${RED}, is it installed?" >&2
Expand All @@ -62,6 +62,16 @@ Prerequisite() {
fi
}

XcolorPrerequisite() {
dependencies=(xcolor)
for dependency in "${dependencies[@]}"; do
type -p "$dependency" &>/dev/null || {
echo -e ${RED}"ERROR: Could not find ${GREEN}'${dependency}'${RED}, is it installed?" >&2
{ reset_color; exit 1; }
}
done
}

## Usage
usage() {
clear
Expand Down Expand Up @@ -180,6 +190,7 @@ show_feh() {

## Pick the colors
color_picker() {
XcolorPrerequisite
picker_app="xcolor --format hex --preview-size 255 --scale 10"
if [[ "$SOLID" == "true" ]]; then
{ echo; echo -n ${ORANGE}"Pick a color... "; }
Expand Down Expand Up @@ -278,7 +289,7 @@ get_xcolors() {
## Get colors
get_color() {
while true; do
{ echo; read -p ${ORANGE}"Pick Colors or Enter Colors or fetch from .Xresources file? (p/e/x): "${BLUE}; }
{ echo; read -p ${ORANGE}"(P)ick Colors or (E)nter Colors or fetch from .(X)resources file? Picking colors (p) requires xcolor. (p/e/x): "${BLUE}; }
if [[ $REPLY =~ ^[p/P/e/E/x/X]$ ]]; then
if [[ $REPLY == "p" ]] || [[ $REPLY == "P" ]]; then
color_picker
Expand Down