feat(render_assets): make optipng optional (#336)
feat(render_assets): make optipng optional
fix(change_color.sh): add two missing fallback values
feat(render_assets): make optipng optional
fix(change_color.sh): add two missing fallback values
by roundabout, Sunday, 23 December 2018, 05:30:36 (1545543036), pushed by roundabout, Sunday, 11 May 2025, 13:22:31 (1746969751)
Author identity: nana-4 <nana-4@users.noreply.github.com>
17e6b3567ffe319ce45222415ac067344987fffd
HDR_FG=${HDR_FG-$MENU_FG}
MATERIA_VIEW=${MATERIA_VIEW-$TXT_BG}
MATERIA_SURFACE=${MATERIA_SURFACE-$BTN_BG}
GNOME_SHELL_PANEL_OPACITY=${GNOME_SHELL_PANEL_OPACITY-0.6}
MATERIA_PANEL_OPACITY=${MATERIA_PANEL_OPACITY-$GNOME_SHELL_PANEL_OPACITY}
MATERIA_STYLE_COMPACT=$(tr '[:upper:]' '[:lower:]' <<< "${MATERIA_STYLE_COMPACT-True}")
# shellcheck disable=SC2034 # will this be used in the future?
ROUNDNESS_GTK2_HIDPI=$(( ROUNDNESS * 2 ))
MATERIA_PANEL_OPACITY=${MATERIA_PANEL_OPACITY-0.6}
MATERIA_SELECTION_OPACITY=${MATERIA_SELECTION_OPACITY-0.32}
INACTIVE_FG=$(mix "$FG" "$BG" 0.75)
INACTIVE_MATERIA_VIEW=$(mix "$MATERIA_VIEW" "$BG" 0.60)
fi
if [[ ! "$(which optipng 2> /dev/null)" ]]; then
echo "'optipng' needs to be installed to generate the PNG."
exit 1
echo "'optipng' needs to be installed to optimize the resulting PNG!"
fi
chrome() (
set -ueo pipefail
RENDER_SVG="$(command -v rendersvg)" || true
INKSCAPE="$(command -v inkscape)"
OPTIPNG="$(command -v optipng)"
INKSCAPE="$(command -v inkscape)" || true
OPTIPNG="$(command -v optipng)" || true
i="$1"
"$INKSCAPE" --export-dpi=96 --export-png="$i.png" "$i.svg" >/dev/null
fi
"$OPTIPNG" -o7 --quiet "$i.png"
if [[ -n "${OPTIPNG}" ]] ; then
"$OPTIPNG" -o7 --quiet "$i.png"
fi
set -ueo pipefail
RENDER_SVG="$(command -v rendersvg)" || true
INKSCAPE="$(command -v inkscape)"
OPTIPNG="$(command -v optipng)"
INKSCAPE="$(command -v inkscape)" || true
OPTIPNG="$(command -v optipng)" || true
if [[ "$1" == "dark" ]]; then
SRC_FILE="assets-dark.svg"
--export-png="$ASSETS_DIR/$i.png" "$SRC_FILE" >/dev/null
fi
"$OPTIPNG" -o7 --quiet "$ASSETS_DIR/$i.png"
if [[ -n "${OPTIPNG}" ]] ; then
"$OPTIPNG" -o7 --quiet "$ASSETS_DIR/$i.png"
fi
set -ueo pipefail
RENDER_SVG="$(command -v rendersvg)" || true
INKSCAPE="$(command -v inkscape)"
OPTIPNG="$(command -v optipng)"
INKSCAPE="$(command -v inkscape)" || true
OPTIPNG="$(command -v optipng)" || true
SRC_FILE="assets.svg"
ASSETS_DIR="assets"
--export-id-only \
--export-png="$ASSETS_DIR/$i.png" "$SRC_FILE" >/dev/null
fi
"$OPTIPNG" -o7 --quiet "$ASSETS_DIR/$i.png"
if [[ -n "${OPTIPNG}" ]] ; then
"$OPTIPNG" -o7 --quiet "$ASSETS_DIR/$i.png"
fi
echo "Rendering '$ASSETS_DIR/$i@2.png'"
if [[ -n "${RENDER_SVG}" ]] ; then
--export-dpi=192 \
--export-png="$ASSETS_DIR/$i@2.png" "$SRC_FILE" >/dev/null
fi
"$OPTIPNG" -o7 --quiet "$ASSETS_DIR/$i@2.png"
if [[ -n "${OPTIPNG}" ]] ; then
"$OPTIPNG" -o7 --quiet "$ASSETS_DIR/$i@2.png"
fi