Update "Adwaita-maia" from the adwaita-colors package

A while ago I recolored the icons of this theme to match the Manjaro colors, which got added into the repos as a patch, I believe. I suggest the maia icons are updated to more closely resemble the Adwaita style:

Using the maia accent as dark color and #b9e2da as light, which I can change to something else.

Here is the theme: https://drive.google.com/file/d/1gKUx_rnm0VuOwELvZIE7H65GrWiSmgTl/view?usp=sharing
Morewaita should be installed so it falls back to it

And here is the script that I used, though it’s AI generated, but I troubleshooted it
Tell me if you see issues with icon colors

#!/bin/bash

# ============================================================
# Adwaita / MoreWaita recolor script
# ============================================================

set -e

print_status()  { echo "[+] $1"; }
print_warning() { echo "[~] $1"; }
print_error()   { echo "[!] $1"; }

# ------------------------------------------------------------
# Fixed colors
# ------------------------------------------------------------
LIGHT_COLOR="#b9e2da"
MIDDLE_COLOR="#4ab6a3"   # ratio-derived from light → dark
DARK_COLOR="#16a085"

print_status "Using colors:"
echo "  Light : $LIGHT_COLOR"
echo "  Middle: $MIDDLE_COLOR"
echo "  Dark  : $DARK_COLOR"

# ------------------------------------------------------------
# Helpers
# ------------------------------------------------------------
find_icon_theme() {
    local name="$1"
    for p in \
        "$HOME/.icons/$name" \
        "$HOME/.local/share/icons/$name" \
        "/usr/share/icons/$name" \
        "/usr/local/share/icons/$name"
    do
        [ -d "$p" ] && echo "$p" && return 0
    done
    return 1
}

# ------------------------------------------------------------
# Locate themes
# ------------------------------------------------------------
ADWAITA_SRC=$(find_icon_theme "Adwaita-teal") || {
    print_error "Adwaita-teal not found"
    exit 1
}

MOREWAITA_SRC=$(find_icon_theme "MoreWaita") || {
    print_error "MoreWaita not found"
    exit 1
}

TARGET="$HOME/.icons/Adwaita-custom"

# ------------------------------------------------------------
# Copy base theme
# ------------------------------------------------------------
print_status "Creating Adwaita-custom…"
rm -rf "$TARGET"
cp -r "$ADWAITA_SRC" "$TARGET"

# ------------------------------------------------------------
# index.theme edits
# ------------------------------------------------------------
INDEX="$TARGET/index.theme"

sed -i \
    -e 's/^Name=.*/Name=Adwaita-custom/' \
    -e 's/^Inherits=.*/Inherits=MoreWaita,Adwaita,AdwaitaLegacy,hicolor/' \
    "$INDEX"

# ------------------------------------------------------------
# SVG recoloring
# ------------------------------------------------------------
print_status "Recoloring SVG files…"

find "$TARGET/scalable" -type f -name "*.svg" | while read -r svg; do
    # Dark tones
    sed -i \
        -e "s/#129eb0/$DARK_COLOR/gi" \
        -e "s/#2190a4/$DARK_COLOR/gi" \
        -e "s/#108094/$DARK_COLOR/gi" \
        -e "s/#1d8094/$DARK_COLOR/gi" \
        -e "s/#40c1d9/$DARK_COLOR/gi" \
        "$svg"

    # Middle tones
    sed -i \
        -e "s/#3da7bc/$MIDDLE_COLOR/gi" \
        "$svg"

    # Light tones
    sed -i \
        -e "s/#9edae6/$LIGHT_COLOR/gi" \
        -e "s/#7bdff4/$LIGHT_COLOR/gi" \
        "$svg"
done

# ------------------------------------------------------------
# Nautilus special handling
# ------------------------------------------------------------
NAUTILUS="$TARGET/scalable/apps/org.gnome.Nautilus.svg"

if [ -f "$NAUTILUS" ]; then
    print_status "Fixing Nautilus icon…"

    sed -i \
        -e "s/#08382e/$DARK_COLOR/gi" \
        -e "s/#0f6c59/$DARK_COLOR/gi" \
        -e "s/#1c7a8c/$MIDDLE_COLOR/gi" \
        -e "s/fill-opacity:[0-9.]\+/fill-opacity:0.5/gi" \
        "$NAUTILUS"
fi

# ------------------------------------------------------------
# Done
# ------------------------------------------------------------
print_status "Adwaita-custom created successfully"
print_status "Location: $TARGET"
print_status "Enable with:"
echo "  gsettings set org.gnome.desktop.interface icon-theme 'Adwaita-custom'"

1 Like

I adapted the script and applied the changes with adwaita-colors-icon-theme 2.4.2-2 in the Manjaro unstable branch.

Thank you, worked for me

Actually wait, I think I might have given a wrong script, since not all colors apply correctly
This is my original script which prompts the user for some things adwaita-colors-icons-customizer/adwaita-colors-icons-customizer.sh at main · pacu23/adwaita-colors-icons-customizer · GitHub, I asked AI to remove the unnecessary things but it seems to have done whatever it wanted to

Maybe now it’s right?

#!/bin/bash
set -euo pipefail

print_status() { :; }
print_error()  { :; }
print_warning(){ :; }

# Find icon theme in common locations
find_icon_theme() {
    local theme_name="$1"
    local search_paths=(
        "$HOME/.icons/$theme_name"
        "$HOME/.local/share/icons/$theme_name"
        "/usr/share/icons/$theme_name"
        "/usr/local/share/icons/$theme_name"
    )
    for path in "${search_paths[@]}"; do
        if [ -d "$path" ]; then
            echo "$path"
            return 0
        fi
    done
    return 1
}

# Ensure hex color has leading #
validate_hex_color() {
    local color="$1"
    if [[ "$color" =~ ^#?[0-9A-Fa-f]{6}$ ]]; then
        [[ "$color" =~ ^# ]] || color="#$color"
        echo "$color"
        return 0
    fi
    return 1
}

# Generate a darker color by applying ratio logic
generate_darker_color() {
    local light_color="${1#\#}"
    local dark_color="${2#\#}"

    # Convert hex to decimal
    local r_light=$((16#${light_color:0:2}))
    local g_light=$((16#${light_color:2:2}))
    local b_light=$((16#${light_color:4:2}))

    local r_dark=$((16#${dark_color:0:2}))
    local g_dark=$((16#${dark_color:2:2}))
    local b_dark=$((16#${dark_color:4:2}))

    # If any light component is zero, avoid division by zero by using a small value
    [ "$r_light" -eq 0 ] && r_light=1
    [ "$g_light" -eq 0 ] && g_light=1
    [ "$b_light" -eq 0 ] && b_light=1

    # Compute ratios and apply them
    local r_ratio g_ratio b_ratio
    r_ratio=$(awk "BEGIN{printf \"%.6f\", $r_dark / $r_light}")
    g_ratio=$(awk "BEGIN{printf \"%.6f\", $g_dark / $g_light}")
    b_ratio=$(awk "BEGIN{printf \"%.6f\", $b_dark / $b_light}")

    local r_darker g_darker b_darker
    r_darker=$(awk "BEGIN{printf \"%d\", ($r_dark * $r_ratio)}")
    g_darker=$(awk "BEGIN{printf \"%d\", ($g_dark * $g_ratio)}")
    b_darker=$(awk "BEGIN{printf \"%d\", ($b_dark * $b_ratio)}")

    # Clamp
    (( r_darker = (r_darker < 0 ? 0 : (r_darker > 255 ? 255 : r_darker)) ))
    (( g_darker = (g_darker < 0 ? 0 : (g_darker > 255 ? 255 : g_darker)) ))
    (( b_darker = (b_darker < 0 ? 0 : (b_darker > 255 ? 255 : b_darker)) ))

    printf "#%02x%02x%02x\n" "$r_darker" "$g_darker" "$b_darker"
}

create_adwaita_custom() {
    local NEW_LIGHT_COLOR NEW_DARK_COLOR DARKER_COLOR
    NEW_LIGHT_COLOR="#b9e2da"
    NEW_DARK_COLOR="#16a085"

    # Validate (keeps format consistent)
    NEW_LIGHT_COLOR=$(validate_hex_color "$NEW_LIGHT_COLOR") || return 1
    NEW_DARK_COLOR=$(validate_hex_color "$NEW_DARK_COLOR")   || return 1

    # Locate source Adwaita-teal theme
    local SOURCE_DIR
    SOURCE_DIR=$(find_icon_theme "Adwaita-teal") || return 1

    local TARGET_DIR="$HOME/.icons/Adwaita-custom"

    # Compute derived darker color
    DARKER_COLOR=$(generate_darker_color "$NEW_LIGHT_COLOR" "$NEW_DARK_COLOR")

    # Remove existing target if present (clean start)
    if [ -d "$TARGET_DIR" ]; then
        rm -rf "$TARGET_DIR"
    fi

    # Copy theme
    cp -r "$SOURCE_DIR" "$TARGET_DIR"

    # Update index.theme: Name and Inherits
    local INDEX_FILE="$TARGET_DIR/index.theme"
    if [ -f "$INDEX_FILE" ]; then
        sed -i 's/^Name=.*$/Name=Adwaita-custom/' "$INDEX_FILE"
        # Replace or add an Inherits line with desired set
        if grep -qi '^Inherits=' "$INDEX_FILE"; then
            sed -i 's/^Inherits=.*$/Inherits=MoreWaita,Adwaita,AdwaitaLegacy,hicolor/' "$INDEX_FILE"
        else
            printf '\nInherits=MoreWaita,Adwaita,AdwaitaLegacy,hicolor\n' >> "$INDEX_FILE"
        fi
    fi

    # Process SVG files in scalable directory (if present)
    local scalable_dir="$TARGET_DIR/scalable"
    if [ -d "$scalable_dir" ]; then
        # Use find -print0 to safely handle filenames
        while IFS= read -r -d '' file; do
            # replace a set of color tokens with chosen colors
            sed -i "s/#129eb0/${NEW_DARK_COLOR}/gi" "$file" || true
            sed -i "s/#2190a4/${NEW_DARK_COLOR}/gi" "$file" || true
            sed -i "s/#108094/${NEW_DARK_COLOR}/gi" "$file" || true
            sed -i "s/#1d8094/${NEW_DARK_COLOR}/gi" "$file" || true
            sed -i "s/#40c1d9/${NEW_DARK_COLOR}/gi" "$file" || true

            sed -i "s/#007184/${DARKER_COLOR}/gi" "$file" || true

            sed -i "s/#9edae6/${NEW_LIGHT_COLOR}/gi" "$file" || true
            sed -i "s/#7bdff4/${NEW_LIGHT_COLOR}/gi" "$file" || true
            sed -i "s/#3da7bc/${NEW_LIGHT_COLOR}/gi" "$file" || true
        done < <(find "$scalable_dir" -type f -name '*.svg' -print0)
    fi

    # Special handling for Nautilus icon (if exists)
    local NAUTILUS_FILE="$TARGET_DIR/scalable/apps/org.gnome.Nautilus.svg"
    if [ -f "$NAUTILUS_FILE" ]; then
        sed -i "s/#08382e/${DARKER_COLOR}/gi" "$NAUTILUS_FILE" || true
        sed -i "s/#0f6c59/${NEW_DARK_COLOR}/gi" "$NAUTILUS_FILE" || true
        sed -i "s/#1c7a8c/${DARKER_COLOR}/gi" "$NAUTILUS_FILE" || true
        sed -i "s/fill-opacity:0\.69749063/fill-opacity:0.5/gi" "$NAUTILUS_FILE" || true
        sed -i "s/fill:#1c7a8c/fill:${DARKER_COLOR}/gi" "$NAUTILUS_FILE" || true
    fi

    return 0
}

# Ensure not run as root
if [ "${EUID:-$(id -u)}" -eq 0 ]; then
    exit 1
fi

# Execute
create_adwaita_custom

exit 0

Tested, seems to work

1 Like

Applied with 2.4.2-3.

Thank you very much, I’m sorry, I should have tested it. Have you considered including Morewaita/Adwaita colors by default, since it’s a more neutral icon pack than Papirus, and new users don’t know it exists?

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.