Use icon@2x as logo@2x in case of a missing logo@2x and no dedicated logo is provided (#3235)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
Robert Resch 2023-11-08 14:32:57 +01:00 committed by GitHub
parent 4ca326492b
commit 99b1717446
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View file

@ -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

View file

@ -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}")