diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..dc5caf936 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.afdesign filter=lfs diff=lfs merge=lfs -text diff --git a/ci/dev/gen_icons.sh b/ci/dev/gen_icons.sh index 55ec0cc6c..9d27486dc 100755 --- a/ci/dev/gen_icons.sh +++ b/ci/dev/gen_icons.sh @@ -14,10 +14,31 @@ main() { # -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="" + # 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% favicon-dark-support.svg } main "$@" diff --git a/src/browser/favicon.afdesign b/src/browser/favicon.afdesign new file mode 100644 index 000000000..b654f32e8 --- /dev/null +++ b/src/browser/favicon.afdesign @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:625d2049c38ae27df0613fa533020e889fa98affd603050f46d3748be7b90d0b +size 38675 diff --git a/src/browser/media/favicon-dark-support.svg b/src/browser/media/favicon-dark-support.svg new file mode 100644 index 000000000..06f1fa00d --- /dev/null +++ b/src/browser/media/favicon-dark-support.svg @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/src/browser/pages/error.html b/src/browser/pages/error.html index 4d24d85f5..73a9599bd 100644 --- a/src/browser/pages/error.html +++ b/src/browser/pages/error.html @@ -11,7 +11,7 @@ content="style-src 'self'; manifest-src 'self'; img-src 'self' data:; font-src 'self' data:;" /> {{ERROR_TITLE}} - code-server - + diff --git a/src/browser/pages/login.html b/src/browser/pages/login.html index 9f74b296f..ef3f16a40 100644 --- a/src/browser/pages/login.html +++ b/src/browser/pages/login.html @@ -11,7 +11,7 @@ content="style-src 'self'; script-src 'self' 'unsafe-inline'; manifest-src 'self'; img-src 'self' data:; font-src 'self' data:;" /> code-server login - + diff --git a/src/browser/pages/vscode.html b/src/browser/pages/vscode.html index c46cb47a2..ef61fa5eb 100644 --- a/src/browser/pages/vscode.html +++ b/src/browser/pages/vscode.html @@ -24,7 +24,7 @@ - +