diff --git a/README.md b/README.md index 3d909aac..2516c15f 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,9 @@ For example: <`https://brands.home-assistant.io/[domain]/icon.png`> - If a domain is missing the `icon.png` file, 404 will be served - If a domain is missing the `logo.png` file, the `icon.png` is served instead (if available). - If a domain is missing the `icon@2x.png` file, the `icon.png` is served instead (if available). -- If a domain is missing the `logo@2x.png` file, the `logo.png` is served instead (if available). +- If a domain is missing the `logo@2x.png` file: + - the `icon@2x.png` is served if available and `logo.png` is missing + - the `logo.png` is served instead (if available). - If a image optimised for dark themes (image is prefixed with 'dark_') is missing, it's non-prefixed match will be served instead (if available). ### With placeholder fallback diff --git a/scripts/build.sh b/scripts/build.sh index 877a5298..03625b96 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -49,6 +49,16 @@ find ./build -type f -name "icon.txt" | while read icon; do echo "Generated mdi:${mdi} for ${icon}" done +# Use icon@2x as logo@2x in case of a missing logo@2x and no dedicated logo is provided for better resolution +# This check must before the missing logo check +find ./build -type f -name "icon@2x.png" | while read icon; do + dir=$(dirname "${icon}") + if [[ ! -f "${dir}/logo2x.png" && ! -f "${dir}/logo.png" ]]; then + cp "${icon}" "${dir}/logo@2x.png" + echo "Using ${icon} as hDPI logo because no logo is provided" + fi +done + # Use icon as logo in case of a missing logo find ./build -type f -name "icon.png" | while read icon; do dir=$(dirname "${icon}")