1
0
mirror of https://github.com/coder/code-server.git synced 2024-12-05 07:13:06 +08:00
code-server/ci/dev/gen_icons.sh
dependabot[bot] 9042bbae9a
chore(deps-dev): bump prettier-plugin-sh from 0.6.1 to 0.7.1 (#3680)
* chore(deps-dev): bump prettier-plugin-sh from 0.6.1 to 0.7.1

Bumps [prettier-plugin-sh](https://github.com/rx-ts/prettier) from 0.6.1 to 0.7.1.
- [Release notes](https://github.com/rx-ts/prettier/releases)
- [Changelog](https://github.com/rx-ts/prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rx-ts/prettier/compare/prettier-plugin-sh@0.6.1...prettier-plugin-sh@0.7.1)

---
updated-dependencies:
- dependency-name: prettier-plugin-sh
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: reformat shell scripts

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Akash Satheesan <akash.satheesan@protonmail.com>
2021-06-28 22:06:55 +05:30

45 lines
1.6 KiB
Bash
Executable File

#!/bin/sh
set -eu
main() {
cd src/browser/media
# We need .ico for backwards compatibility.
# The other two are the only icon sizes required by Chrome and
# we use them for stuff like apple-touch-icon as well.
# https://web.dev/add-manifest/
#
# This should be enough and we can always add more if there are problems.
# -background defaults to white but we want it transparent.
# https://imagemagick.org/script/command-line-options.php#background
convert -quiet -background transparent -resize 256x256 favicon.svg favicon.ico
# We do not generate the pwa-icon from the favicon as they are slightly different
# designs and sizes.
# See favicon.afdesign and #2401 for details on the differences.
convert -quiet -background transparent -resize 192x192 pwa-icon.png pwa-icon-192.png
convert -quiet -background transparent -resize 512x512 pwa-icon.png pwa-icon-512.png
# We use -quiet above to avoid https://github.com/ImageMagick/ImageMagick/issues/884
# The following adds dark mode support for the favicon as favicon-dark-support.svg
# There is no similar capability for pwas or .ico so we can only add support to the svg.
favicon_dark_style="<style>
@media (prefers-color-scheme: dark) {
* {
fill: white;
}
}
</style>"
# See https://stackoverflow.com/a/22901380/4283659
# This escapes all newlines so that sed will accept them.
favicon_dark_style="$(printf "%s\n" "$favicon_dark_style" | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/\\n/g')"
sed "$(
cat -n << EOF
s%<rect id="favicon"%$favicon_dark_style<rect id="favicon"%
EOF
)" favicon.svg > favicon-dark-support.svg
}
main "$@"