Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

573 create icons 优化 #576

Merged
merged 5 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@


# icons
icons/icons
icons/platform
icons/*
!icons/logo*.png
!icons/create.sh
!icons/logo.svg
!icons/index.html
themes/gallery/public/icon_*.png
apps/electron/build/icon.*

.idea

Expand Down Expand Up @@ -31,9 +36,6 @@ dist/
releases/
expo-env.d.ts

# production
build

# misc
**/.DS_Store
*.pem
Expand All @@ -56,3 +58,5 @@ yarn-error.log*

# turbo
.turbo


2 changes: 1 addition & 1 deletion README-EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pnpm dev
---

<a href="https://eagle.sjv.io/rao">
<img src="./screenshot/eagle.svg" width="96" alt="eagle app" />
<img src="https://file.notion.so/f/f/e28893ab-ca65-405a-a390-f6c1f240bb0a/cee66542-d85e-4996-832c-4e99434f2d53/Logo.svg?id=d04cf110-ecc6-4b3c-9e0f-c58349400971&table=block&spaceId=e28893ab-ca65-405a-a390-f6c1f240bb0a&expirationTimestamp=1702627200000&signature=mmZLHr8usXJtRpHSaQHy90BkGR36o_25VLj3bg1O74U&downloadName=Logo.svg" width="96" alt="eagle app" />
</a>

## License
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ pnpm dev
---

<a href="https://eagle.sjv.io/rao">
<img src="./screenshot/eagle.svg" width="96" alt="eagle app" />
<img src="https://file.notion.so/f/f/e28893ab-ca65-405a-a390-f6c1f240bb0a/cee66542-d85e-4996-832c-4e99434f2d53/Logo.svg?id=d04cf110-ecc6-4b3c-9e0f-c58349400971&table=block&spaceId=e28893ab-ca65-405a-a390-f6c1f240bb0a&expirationTimestamp=1702627200000&signature=mmZLHr8usXJtRpHSaQHy90BkGR36o_25VLj3bg1O74U&downloadName=Logo.svg" width="96" alt="eagle app" />
</a>

## 许可证
Expand Down
57 changes: 30 additions & 27 deletions icons/create_icon.sh → icons/create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@
set -eo pipefail

# Config
SOURCE_FILE_PATH='./1024x1024.png' # has to be of size 1024x1024 px
SOURCE_FILE_PATH='./logo.png' # has to be of size 1024x1024 px
OUT_ICON_NAME='icon'

rm -rf ./icons
rm -rf "./${OUT_ICON_NAME}.iconset"
rm -rf "./${OUT_ICON_NAME}_shadow_rounded.iconset"
rm -rf "./${OUT_ICON_NAME}_rounded.iconset"

sizes=(
16x16
32x32
128x128
256x256
512x512
)


# The "design" and magic numbers below are derived from Apple's macOS app icon
Expand All @@ -27,19 +37,10 @@ if ! hash convert 2>/dev/null || ! hash iconutil 2>/dev/null; then
exit 1
fi


# Prepare an iconset folder
mkdir "./${OUT_ICON_NAME}.iconset"
mkdir "./${OUT_ICON_NAME}_shadow_rounded.iconset"
mkdir "./${OUT_ICON_NAME}_rounded.iconset"


# Add rounded corners to the 1024px image.
#
# This works by:
# 1. Generating a black square (1024 px) with rounded corners (radius 234 px)
# on transparent background, via `-size [...] xc:none -draw [...]`
# 2. Applying the square as a mask to the the source image, via `-matte [...]`
convert "${SOURCE_FILE_PATH}" \
-matte \( \
-size 1024x1024 xc:none -draw "roundrectangle 0,0,1024,1024,234,234" \
Expand All @@ -50,16 +51,9 @@ convert "${SOURCE_FILE_PATH}" \

convert "${SOURCE_FILE_PATH}" \
-resize 824x824 \
"./${OUT_ICON_NAME}.iconset/temp_1024.png"
"./${OUT_ICON_NAME}.iconset/temp_1024.png"


# Apply sizing and add shadow to the 1024px image.
#
# This works by:
# 1. Resizing to 'icon grid size' (824px), via `-resize`
# 2. Adding padding (100px) to get 'outer bounding box' size,
# via `-bordercolor none -border [...]`
# 3. Adding shadow, via `+clone -background black -shadow [...]`
convert "./${OUT_ICON_NAME}.iconset/temp_1024_rounded.png" \
-resize 824x824 \
-bordercolor none -border 100x100 \
Expand All @@ -82,6 +76,7 @@ convert "./${OUT_ICON_NAME}.iconset/temp_1024.png" \
rm "./${OUT_ICON_NAME}.iconset/temp_1024_rounded.png"
rm "./${OUT_ICON_NAME}.iconset/temp_1024.png"


# Generate all sizes.
# 16/32/128/256/512, each single & double resolution
cd "./${OUT_ICON_NAME}.iconset/"
Expand Down Expand Up @@ -129,13 +124,21 @@ cd '..'
# Convert to .icns format and remove iconset
iconutil -c icns "./${OUT_ICON_NAME}_shadow_rounded.iconset"

mkdir icons
mv "./${OUT_ICON_NAME}_shadow_rounded.icns" "./icons/${OUT_ICON_NAME}.icns"
mv "./${OUT_ICON_NAME}_shadow_rounded.iconset" "./icons/${OUT_ICON_NAME}_shadow_rounded"
mv "./${OUT_ICON_NAME}_rounded.iconset" "./icons/${OUT_ICON_NAME}_rounded"
mv "./${OUT_ICON_NAME}.iconset" "./icons/${OUT_ICON_NAME}"

npx electron-icon-builder --input=./icons/icon_shadow_rounded/icon_512x512@2x.png --output=./platform
# Generate .ico file for windows
ICON_FILES=""
ICONSET_FOLDER="./${OUT_ICON_NAME}_shadow_rounded.iconset"
for size in "${sizes[@]}"; do
ICON_FILES="$ICON_FILES $ICONSET_FOLDER/icon_${size}.png"
ICON_FILES="$ICON_FILES $ICONSET_FOLDER/icon_${size}@2x.png"
done

convert $ICON_FILES "${OUT_ICON_NAME}_shadow_rounded.ico"

# copy to electron
cp "./${OUT_ICON_NAME}_shadow_rounded.icns" ../apps/electron/build/icon.icns
cp "./${OUT_ICON_NAME}_shadow_rounded.ico" ../apps/electron/build/icon.ico

mv ./platform/icons/mac/icon.icns ../apps/electron/build/icon.icns
mv ./platform/icons/win/icon.ico ../apps/electron/build/icon.ico
# copy to gallery
cp "./${OUT_ICON_NAME}_rounded.iconset/icon_512x512.png" ../themes/gallery/public/icon_512x512.png
cp "./${OUT_ICON_NAME}_rounded.iconset/icon_192x192.png" ../themes/gallery/public/icon_192x192.png
14 changes: 3 additions & 11 deletions icons/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,7 @@
main {
width: 512px;
height: 512px;
padding: 32px;
/* background-color: #6e7ff30d;
background-image: linear-gradient(
90deg,
#ffffff 10%,
rgba(0, 0, 0, 0) 10%
),
linear-gradient(#ffffff 10%, rgba(0, 0, 0, 0) 10%);
background-size: 20px 20px; */
/* padding: 32px; */
}
div {
width: 100%;
Expand All @@ -32,8 +24,8 @@
#5753c9 48%,
#6e7ff3 100%
);
border-radius: 50%;
box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.2);
/* border-radius: 50%; */
/* box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.2); */
}
</style>
</head>
Expand Down
Binary file added icons/logo-social.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
2 changes: 1 addition & 1 deletion icons/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"@vitest/ui": "^1.0.0",
"cross-env": "^7.0.3",
"dotenv-cli": "^7.3.0",
"electron-icon-builder": "^2.0.1",
"vitest": "^1.0.1"
},
"packageManager": "pnpm@8.11.0",
Expand Down
Loading