mirror of
https://github.com/VSCodium/vscodium.git
synced 2026-04-11 16:27:18 +10:00
enhance(icons): improve icons generator [skip ci]
This commit is contained in:
@@ -6,20 +6,22 @@ set -e
|
||||
# DEBUG
|
||||
# set -o xtrace
|
||||
|
||||
QUALITY="stable"
|
||||
COLOR="blue1"
|
||||
|
||||
while getopts ":i" opt; do
|
||||
case "$opt" in
|
||||
i)
|
||||
export QUALITY="insider"
|
||||
export COLOR="orange1"
|
||||
QUALITY="insider"
|
||||
[[ -z "${COLOR}" ]] && COLOR="orange1"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
[[ -z "${COLOR}" ]] && COLOR="blue1"
|
||||
[[ -z "${QUALITY}" ]] && QUALITY="stable"
|
||||
[[ -z "${SRC_PREFIX}" ]] && SRC_PREFIX=""
|
||||
[[ -z "${VSCODE_PREFIX}" ]] && VSCODE_PREFIX=""
|
||||
|
||||
check_programs() { # {{{
|
||||
for arg in "$@"; do
|
||||
if ! command -v "${arg}" &> /dev/null; then
|
||||
@@ -31,27 +33,47 @@ check_programs() { # {{{
|
||||
|
||||
check_programs "icns2png" "composite" "convert" "png2icns" "icotool" "rsvg-convert" "sed"
|
||||
|
||||
. ./utils.sh
|
||||
. "./${VSCODE_PREFIX}utils.sh"
|
||||
|
||||
SRC_PREFIX=""
|
||||
VSCODE_PREFIX=""
|
||||
if ! declare -F load_linux_png &>/dev/null; then
|
||||
load_linux_png() {
|
||||
wget "https://raw.githubusercontent.com/VSCodium/icons/main/icons/linux/circle1/${COLOR}/paulo22s.png" -O "$1"
|
||||
}
|
||||
fi
|
||||
|
||||
if ! declare -F load_windows_ico &>/dev/null; then
|
||||
load_windows_ico() {
|
||||
wget "https://raw.githubusercontent.com/VSCodium/icons/main/icons/win32/nobg/${COLOR}/paulo22s.ico" -O "$1"
|
||||
}
|
||||
fi
|
||||
|
||||
build_darwin_main() { # {{{
|
||||
if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/darwin/code.icns" ]]; then
|
||||
rsvg-convert -w 655 -h 655 "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png"
|
||||
composite "code_logo.png" -gravity center "icons/template_macos.png" "code_1024.png"
|
||||
mkdir -p "${SRC_PREFIX}src/${QUALITY}/resources/darwin"
|
||||
|
||||
if [[ "$1" == "no-template" ]]; then
|
||||
rsvg-convert -w 1024 -h 1024 "icons/${QUALITY}/codium_cnl.svg" -o "code_1024.png"
|
||||
else
|
||||
rsvg-convert -w 655 -h 655 "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png"
|
||||
composite "code_logo.png" -gravity center "${VSCODE_PREFIX}icons/template_macos.png" "code_1024.png"
|
||||
fi
|
||||
|
||||
convert "code_1024.png" -resize 512x512 code_512.png
|
||||
convert "code_1024.png" -resize 256x256 code_256.png
|
||||
convert "code_1024.png" -resize 128x128 code_128.png
|
||||
|
||||
png2icns "${SRC_PREFIX}src/${QUALITY}/resources/darwin/code.icns" code_512.png code_256.png code_128.png
|
||||
|
||||
rm code_1024.png code_512.png code_256.png code_128.png code_logo.png
|
||||
rm -f code_1024.png code_512.png code_256.png code_128.png code_logo.png
|
||||
fi
|
||||
} # }}}
|
||||
|
||||
build_darwin_types() { # {{{
|
||||
rsvg-convert -w 128 -h 128 "icons/${QUALITY}/codium_cnl_w80_b8.svg" -o "code_logo.png"
|
||||
if [[ "$1" == "no-border" ]]; then
|
||||
rsvg-convert -w 128 -h 128 "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png"
|
||||
else
|
||||
rsvg-convert -w 128 -h 128 "icons/${QUALITY}/codium_cnl_w80_b8.svg" -o "code_logo.png"
|
||||
fi
|
||||
|
||||
for file in "${VSCODE_PREFIX}"vscode/resources/darwin/*; do
|
||||
if [[ -f "${file}" ]]; then
|
||||
@@ -60,7 +82,7 @@ build_darwin_types() { # {{{
|
||||
if [[ "${name}" != 'code' ]] && [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/darwin/${name}.icns" ]]; then
|
||||
icns2png -x -s 512x512 "${file}" -o .
|
||||
|
||||
composite -blend 100% -geometry +323+365 "icons/corner_512.png" "${name}_512x512x32.png" "${name}.png"
|
||||
composite -blend 100% -geometry +323+365 "${VSCODE_PREFIX}icons/corner_512.png" "${name}_512x512x32.png" "${name}.png"
|
||||
composite -geometry +359+374 "code_logo.png" "${name}.png" "${name}.png"
|
||||
|
||||
convert "${name}.png" -resize 256x256 "${name}_256.png"
|
||||
@@ -77,26 +99,32 @@ build_darwin_types() { # {{{
|
||||
|
||||
build_linux_main() { # {{{
|
||||
if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/linux/code.png" ]]; then
|
||||
wget "https://raw.githubusercontent.com/VSCodium/icons/main/icons/linux/circle1/${COLOR}/paulo22s.png" -O "${SRC_PREFIX}src/${QUALITY}/resources/linux/code.png"
|
||||
mkdir -p "${SRC_PREFIX}src/${QUALITY}/resources/linux"
|
||||
|
||||
load_linux_png "${SRC_PREFIX}src/${QUALITY}/resources/linux/code.png"
|
||||
fi
|
||||
|
||||
mkdir -p "${SRC_PREFIX}src/${QUALITY}/resources/linux/rpm"
|
||||
|
||||
if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/linux/rpm/code.xpm" ]]; then
|
||||
mkdir -p "${SRC_PREFIX}src/${QUALITY}/resources/linux/rpm"
|
||||
|
||||
convert "${SRC_PREFIX}src/${QUALITY}/resources/linux/code.png" "${SRC_PREFIX}src/${QUALITY}/resources/linux/rpm/code.xpm"
|
||||
fi
|
||||
} # }}}
|
||||
|
||||
build_media() { # {{{
|
||||
if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/src/vs/workbench/browser/media/code-icon.svg" ]]; then
|
||||
mkdir -p "${SRC_PREFIX}src/${QUALITY}/src/vs/workbench/browser/media"
|
||||
|
||||
cp "icons/${QUALITY}/codium_clt.svg" "${SRC_PREFIX}src/${QUALITY}/src/vs/workbench/browser/media/code-icon.svg"
|
||||
gsed -i 's|width="100" height="100"|width="1024" height="1024"|' "${SRC_PREFIX}src/${QUALITY}/src/vs/workbench/browser/media/code-icon.svg"
|
||||
fi
|
||||
} # }}}
|
||||
|
||||
build_server() { # {{{
|
||||
mkdir -p "${SRC_PREFIX}src/${QUALITY}/resources/server"
|
||||
|
||||
if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/server/favicon.ico" ]]; then
|
||||
wget "https://raw.githubusercontent.com/VSCodium/icons/main/icons/win32/nobg/${COLOR}/paulo22s.ico" -O "${SRC_PREFIX}src/${QUALITY}/resources/server/favicon.ico"
|
||||
load_windows_ico "${SRC_PREFIX}src/${QUALITY}/resources/server/favicon.ico"
|
||||
fi
|
||||
|
||||
if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/server/code-192.png" ]]; then
|
||||
@@ -110,7 +138,9 @@ build_server() { # {{{
|
||||
|
||||
build_windows_main() { # {{{
|
||||
if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/code.ico" ]]; then
|
||||
wget "https://raw.githubusercontent.com/VSCodium/icons/main/icons/win32/nobg/${COLOR}/paulo22s.ico" -O "${SRC_PREFIX}src/${QUALITY}/resources/win32/code.ico"
|
||||
mkdir -p "${SRC_PREFIX}src/${QUALITY}/resources/win32"
|
||||
|
||||
load_windows_ico "${SRC_PREFIX}src/${QUALITY}/resources/win32/code.ico"
|
||||
fi
|
||||
} # }}}
|
||||
|
||||
@@ -132,12 +162,16 @@ build_windows_type() { # {{{
|
||||
|
||||
rsvg-convert -w "${LOGO_SIZE}" -h "${LOGO_SIZE}" "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png"
|
||||
|
||||
composite -gravity "${GRAVITY}" "code_logo.png" "${FILE_PATH}" "${FILE_PATH}"
|
||||
if [[ "${GRAVITY}" == "center" ]]; then
|
||||
composite -gravity "${GRAVITY}" "code_logo.png" "${FILE_PATH}" "${FILE_PATH}"
|
||||
else
|
||||
composite -gravity NorthWest -geometry "${GRAVITY}" "code_logo.png" "${FILE_PATH}" "${FILE_PATH}"
|
||||
fi
|
||||
fi
|
||||
} # }}}
|
||||
|
||||
build_windows_types() { # {{{
|
||||
mkdir -p "${SRC_PREFIX}src/${QUALITY}/resources/win32"
|
||||
mkdir -p "${SRC_PREFIX}src/${QUALITY}/resources/win32" "${SRC_PREFIX}build/windows/msi/resources/${QUALITY}"
|
||||
|
||||
rsvg-convert -b "#F5F6F7" -w 64 -h 64 "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png"
|
||||
|
||||
@@ -148,11 +182,11 @@ build_windows_types() { # {{{
|
||||
if [[ "${name}" != 'code' ]] && [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/${name}.ico" ]]; then
|
||||
icotool -x -w 256 "${file}"
|
||||
|
||||
composite -geometry +150+185 "code_logo.png" "${name}_9_256x256x32.png" "${name}.png"
|
||||
composite -geometry +150+185 "code_logo.png" "${name}_1_256x256x32.png" "${name}.png"
|
||||
|
||||
convert "${name}.png" -define icon:auto-resize=256,128,96,64,48,32,24,20,16 "${SRC_PREFIX}src/${QUALITY}/resources/win32/${name}.ico"
|
||||
|
||||
rm "${name}_9_256x256x32.png" "${name}.png"
|
||||
rm "${name}_1_256x256x32.png" "${name}.png"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user