Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3a981257 authored by Markus Heiser's avatar Markus Heiser
Browse files

[simple theme] create favicon.png from src/svg/searxng-wordmark.svg



new bash function convert_if_newer() / usage::

    convert_if_newer <origfile> <outfile> [<options>, ...]
    convert_if_newer "path/to/origin.svg" "path/to/converted.png" -transparent white -resize 64x64

Run's ImageMagik' convert comand to generate <outfile> from <origfile>, if
<origfile> is newer than <outfile>.  The command line is to convert is::

    convert <origfile> [<options>, ...] <outfile>

PNG 'searx/static/themes/simple/img/favicon.png' has been created by::

  $ make themes.simple
  CONVERT   searx/static/themes/simple/src/svg/searxng-wordmark.svg -transparent white -resize 64x64 searx/static/themes/simple/img/favicon.png
  ...

Signed-off-by: default avatarMarkus Heiser <markus.heiser@darmarit.de>
parent bf52353a
Loading
Loading
Loading
Loading
+36 −2
Original line number Diff line number Diff line
@@ -692,11 +692,45 @@ themes.oscar() {
}

themes.simple() {
    local src="searx/static/themes/simple/src"
    local static="searx/static/themes/simple"
    (   set -e
        convert_if_newer "$src/svg/searxng-wordmark.svg" "$static/img/favicon.png" \
                         -transparent white -resize 64x64
        build_msg GRUNT "theme: simple"
        npm --prefix searx/static/themes/simple run build
    )
    dump_return $?
}

convert_if_newer() {

    # usage: convert_if_newer <origfile> <outfile> [<options>, ...]
    #
    #    convert_if_newer "path/to/origin.svg" "path/to/converted.png" -resize 100x100
    #
    # Run's ImageMagik' convert comand to generate <outfile> from <origfile>, if
    # <origfile> is newer than <outfile>.  The command line is to convert is::
    #
    #    convert <origfile> [<options>, ...] <outfile>

    local src_file="$1" && shift
    local dst_file="$1" && shift

    if [[ "${src_file}" -nt "${dst_file}" ]]; then
        if ! required_commands convert; then
            info_msg "to install build tools use::"
            info_msg "   sudo -H ./utils/searx.sh install buildhost"
            die 1 "install needed build tools first"
        fi
        build_msg CONVERT "${src_file}" "$@" "${dst_file}"
        convert "${src_file}" "$@" "${dst_file}"
    else
        build_msg CONVERT "${dst_file} (up-to-date)"
    fi
}


PYLINT_FILES=()
while IFS= read -r line; do
   PYLINT_FILES+=("$line")
+3.18 KiB (4.62 KiB)
Loading image diff...
+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ STATIC_BUILT_PATHS=(
    searx/static/themes/simple/css
    searx/static/themes/simple/js
    searx/static/themes/simple/src/generated/pygments.less
    searx/static/themes/simple/img/favicon.png
    searx/templates/__common__/searxng-wordmark.min.svg
)