Edit: Non functional changes. Lookafeel…
Color Your Mabox 3D Logo!
Only for entertainment purposes — just a playful way to experiment with recoloring the Mabox 3D logo.
@napcok is cooking up something more advanced and polished — but in the meantime, this little script was made just for fun. It offers a simple, visual way to tweak the colors of the SVG-based 3D Mabox logo using yad
, ImageMagick
.
About the SVG
This is a static SVG file containing a 3D-style version of the Mabox logo. Since SVG files can have wildly different internal structures, the script is written specifically for this version — no guarantees it’ll work with others.
Make sure to save the SVG file as:
~/.icons/mb-logo-3d.svg
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="1350"
height="1404.5"
version="1.1"
viewBox="0 0 1350 1404.5"
id="svg154"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs154" />
<style
id="style1">.measure-arrow
{
}
.measure-label
{
}
.measure-line
{
}</style>
<g
transform="translate(7.4904,11.012)"
id="g4">
<path
d="m 42.16,247.16 71.719,726.26 551.61,364.66 554.16,-367.41 65.029,-726.18 -616.27,-204.02 z"
fill="#EEDADA"
id="path3" />
<path
d="M 113.61,974.19 C 96.839,818.54 94.397,795.35 41.584,246.13 l 626.71,-206.28 623.29,202.78 -69.336,733.18 -557.89,368.76 z M 640.57,536.98 C 637.3278,534.2132 57.87,269.13 57.19,270.1 c 0,0 43.103,463.12 65.154,694.62 175.89,115.17 351.35,231.05 526.95,346.68 z m -174.46,613.76 c 0,0 -12.32,-302.85 -17.326,-453.86 l -39.155,-17.644 13.867,443.04 c -1.8417,-0.5414 -123.63,-79.894 -123.63,-79.894 l -28.113,-427.64 -31.494,-14.84 23.964,415.01 c 0.13363,2.314 -112.08,-69.499 -112.15,-70.137 l -58.895,-604.94 503.76,235.5 c 0,0 4.7585,663.97 4.0552,663.58 z m 742.27,-183.77 64.614,-691.09 c 0,-0.0294 -588.8,263.04 -588.8,263.04 0,0 -2.2797,771.42 0.44375,772.48 z M 732.03,575.54 1234.89,343.17 c 0,0 -33.266,401.95 -51.188,602.78 -39.452,21.937 -116.5,70.803 -116.5,70.803 l 24.7,-426.73 -33.281,17.21 c 0,0 -18.494,291.63 -28.557,437.36 l -125.27,76.008 14.896,-440.77 -38.658,20.077 -17.691,451.68 -140.31,87.831 c -1.6774,-139.65 9.0024,-663.87 9.0024,-663.87 z M 1252.59,243.62 667.56,51.89 86.47,240.92 659.92,501.22 Z m -828.32,124.89 29.515,-183.46 426.42,8.9635 18.257,174.98 z m 440.8,-163.92 -399.2,-7.1312 -22.951,159.87 438.91,0.55908 z m -249.67,140.79 4.2318,-99.35 -30.318,0.23782 -9.1938,99.296 -113.02,0.0377 19.851,-136.87 358.64,4.8382 13.082,132.39 -105.23,-0.0569 -3.7982,-99.655 -31.414,-0.43053 2.5359,99.586 z"
fill="#162704"
image-rendering="optimizeQuality"
stroke-width="5.5469"
id="path4" />
<rect
x="-7.4903998"
y="-11.012"
width="1350"
height="1404.5"
fill="none"
id="rect4" />
</g>
<path
class="path35 path-effect52 measure-helper-line measure-line"
d="M 7.4904,11.012"
display="none"
marker-end="url(#ArrowDIN-end)"
marker-start="url(#ArrowDIN-start)"
stroke="#000000"
stroke-width="0.94488"
id="path5" />
<path
class="path35 path-effect52 measure-helper-line measure-line"
d="M 7.4904,11.012"
display="none"
marker-end="url(#ArrowDIN-end)"
marker-start="url(#ArrowDIN-start)"
stroke="#000000"
stroke-width="0.94488"
id="path153" />
<path
class="path35 path-effect52 measure-DIM-line measure-line"
d="M 7.4904,11.012"
display="none"
marker-end="url(#ArrowDIN-end)"
marker-start="url(#ArrowDIN-start)"
stroke="#000000"
stroke-width="0.94488"
id="path154" />
</svg>
Give name to script and save to ~/bin
.
#!/bin/bash
SVG="$HOME/.icons/mb-logo-3d.svg"
TMP_SVG="/tmp/mabox_3d_temp.svg"
ICON_PNG="/tmp/mabox_icon.png"
# Convert SVG to PNG at runtime.
magick convert -background none -resize 64x64 "$SVG" "$ICON_PNG"
LANG_CODE="${LANG:0:2}"
translate() {
case "$1" in
title)
case "$LANG_CODE" in
pl) echo "Mabox Logo Color Dostosowanie koloru" ;;
es) echo "Mabox Logo Color Ajuste de color" ;;
*) echo "Mabox Logo Color adjustment" ;;
esac ;;
background)
case "$LANG_CODE" in
pl) echo "Tło" ;;
es) echo "Fondo" ;;
*) echo "Background" ;;
esac ;;
foreground)
case "$LANG_CODE" in
pl) echo "Pierwszy plan" ;;
es) echo "Primer plano" ;;
*) echo "Foreground" ;;
esac ;;
both_option)
case "$LANG_CODE" in
pl) echo "✅ Zmień oba kolory" ;;
es) echo "✅ Cambiar ambos colores" ;;
*) echo "✅ Change both colors" ;;
esac ;;
done_text)
case "$LANG_CODE" in
pl) echo "✅ Kolory zostały zmienione i tint2 został odświeżony.\n\nCzy chcesz zmienić ponownie?" ;;
es) echo "✅ Colores actualizados y tint2 recargado.\n\n¿Quieres cambiar de nuevo?" ;;
*) echo "✅ Colors updated and tint2 refreshed.\n\nDo you want to modify again?" ;;
esac ;;
stop_button)
case "$LANG_CODE" in
pl) echo "❌ Zakończ" ;;
es) echo "❌ Salir" ;;
*) echo "❌ Stop" ;;
esac ;;
again_button)
case "$LANG_CODE" in
pl) echo "🔁 Zmień ponownie" ;;
es) echo "🔁 Cambiar de nuevo" ;;
*) echo "🔁 Modify again" ;;
esac ;;
cancel_msg)
case "$LANG_CODE" in
pl) echo "Anulowano." ;;
es) echo "Cancelado." ;;
*) echo "Cancelled." ;;
esac ;;
esac
}
pick_color() {
local selected
selected=$(yad --color --init-color="$1" --title="$(translate title)")
if [ $? -ne 0 ] || [ -z "$selected" ]; then
echo "cancelled"
else
echo "$selected"
fi
}
while true; do
cp "$SVG" "$TMP_SVG"
# Detect current colors A and B.
COLOR_A=$(grep -oP 'fill="#\K[0-9a-fA-F]{6}' "$SVG" | head -n 1)
COLOR_B=$(grep -oP 'fill="#\K[0-9a-fA-F]{6}' "$SVG" | tail -n 1)
DISPLAY_A="#$COLOR_A"
DISPLAY_B="#$COLOR_B"
# Show colors in yad.
COLOR_A_TEXT="<span background='$DISPLAY_A'> </span>"
COLOR_B_TEXT="<span background='$DISPLAY_B'> </span>"
# Yad menu.
CHOICE=$(yad --title="$(translate title)" \
--window-icon="adjustrgb" \
--image="$ICON_PNG" \
--width=365 --height=180 \
--list \
--column="$(translate background) $COLOR_A_TEXT" --column="$(translate foreground) $COLOR_B_TEXT" \
"$(translate both_option)" \
--center --markup)
[ $? -ne 0 ] && echo "$(translate cancel_msg)" && exit 0
# Change colors. First background.
NEW_A=$(pick_color "$DISPLAY_A")
[ "$NEW_A" = "cancelled" ] && echo "$(translate cancel_msg)" && continue
NEW_B=$(pick_color "$DISPLAY_B")
[ "$NEW_B" = "cancelled" ] && echo "$(translate cancel_msg)" && continue
sed -i "0,/<path.*fill=\"#${COLOR_A}\"/s/fill=\"#${COLOR_A}\"/fill=\"$NEW_A\"/" "$TMP_SVG"
sed -i "0,/<path.*fill=\"#${COLOR_B}\"/s/fill=\"#${COLOR_B}\"/fill=\"$NEW_B\"/" "$TMP_SVG"
mv "$TMP_SVG" "$SVG"
pkill -SIGUSR1 tint2
# Convert SVG to PNG at runtime, to update yad image on the spot.
magick convert -background none -resize 64x64 "$SVG" "$ICON_PNG"
# Repeat action. Yad menu.
yad --title="$(translate title)" \
--text="$(translate done_text)" \
--button="$(translate stop_button)":1 \
--button="$(translate again_button)":0 \
--center
[ $? -ne 0 ] && echo "Done. Exiting." && exit 0
done
Have fun…