Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore(brand): adopt SVG bird logo across app and README

johnnyjoyghe051129f1db8
diff --git a/.github/assets/memos-wordmark.svg b/.github/assets/memos-wordmark.svg
new file mode 100644
index 000000000..ee3c28f7b
--- /dev/null
+++ b/.github/assets/memos-wordmark.svg
@@ -0,0 +1,11 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="145" height="48" viewBox="0 0 145 48" fill="#477FA8" role="img" aria-labelledby="title">
+ <title id="title">Memos</title>
+ <!-- Standard mark: usememos/.github@5e3121450f5160c7b6b7c301379c27fedf7985d1. -->
+ <svg width="31" height="48" viewBox="112 32 288 448">
+ <g transform="translate(17.067 28.624) scale(1.427919 1.322148)">
+ <path fill-rule="evenodd" d="M126 35 C142 26 162 27 178 35 C195 44 204 63 204 84 C205 102 197 116 197 130 C199 141 212 150 223 165 C239 187 247 221 245 247 Q245 260 239 264 C233 251 232 238 230 225 C227 196 217 173 202 154 C189 141 184 133 189 116 C194 103 196 89 193 78 C184 89 174 100 160 103 Q156 104 152 100 C145 122 133 145 130 167 C144 185 161 195 177 220 C195 248 204 278 198 300 Q196 307 192 309 C187 286 183 266 173 242 C163 219 145 202 129 188 L128 225 Q128 233 120 237 Q115 240 113 245 C114 261 120 279 125 294 Q126 303 119 297 C111 285 108 273 104 261 C96 278 97 299 104 318 Q106 326 99 323 C86 304 82 278 92 256 C97 243 107 231 119 225 C116 207 117 185 121 166 C125 142 136 119 145 95 Q147 87 139 82 L111 67 C104 78 94 85 88 89 Q84 91 87 85 C93 72 102 57 113 49 Q115 43 120 43 Q124 44 118 51 L115 56 L141 69 C145 58 146 46 151 40 Q156 37 156 45 C156 59 151 76 152 87 Q154 95 164 92 C178 87 188 76 188 69 C184 51 172 40 155 37 Q140 34 126 39 Q119 41 126 35 Z M162 130 C157 145 150 158 147 168 Q146 172 151 170 L156 166 L162 151 L166 168 L158 181 Q155 186 160 185 C169 181 174 173 174 168 L167 144 Q163 125 162 130 Z M197 165 C192 179 190 194 186 205 Q185 209 188 212 C200 232 207 255 209 278 Q210 287 214 281 C222 256 214 234 202 214 Q198 206 198 198 C200 183 201 173 200 166 Q199 160 197 165 Z"/>
+ </g>
+ </svg>
+ <!-- Georgia Regular, 32px, -0.025em tracking; outlined to render without a font dependency. -->
+ <path d="M71.219 34.852H61.422V33.742Q61.953 33.727 62.789 33.633Q63.625 33.539 63.938 33.367Q64.422 33.07 64.648 32.688Q64.875 32.305 64.875 31.727V15.602H64.641L57.078 34.492H56.297L49.094 15.211H48.891V28.445Q48.891 30.367 49.133 31.367Q49.375 32.367 49.875 32.805Q50.219 33.133 51.297 33.43Q52.375 33.727 52.703 33.742V34.852H43.75V33.742Q44.453 33.68 45.227 33.508Q46 33.336 46.422 32.992Q46.969 32.555 47.172 31.648Q47.375 30.742 47.375 28.617V17.273Q47.375 16.289 47.141 15.664Q46.906 15.039 46.469 14.648Q45.984 14.227 45.281 14.023Q44.578 13.82 43.891 13.789V12.68H51.453L57.797 29.305L63.219 15.398Q63.516 14.633 63.727 13.797Q63.938 12.961 63.953 12.68H71.188V13.789Q70.75 13.805 70.07 13.93Q69.391 14.055 69.078 14.164Q68.547 14.352 68.359 14.789Q68.172 15.227 68.172 15.742V31.727Q68.172 32.273 68.359 32.648Q68.547 33.023 69.078 33.305Q69.359 33.461 70.078 33.594Q70.797 33.727 71.219 33.742Z M86.684 31.227Q85.716 33.07 84.091 34.164Q82.466 35.258 80.356 35.258Q78.497 35.258 77.098 34.602Q75.7 33.945 74.794 32.82Q73.888 31.695 73.442 30.195Q72.997 28.695 72.997 27.023Q72.997 25.523 73.473 24.078Q73.95 22.633 74.872 21.477Q75.763 20.367 77.083 19.688Q78.403 19.008 80.044 19.008Q81.731 19.008 82.934 19.539Q84.138 20.07 84.888 20.992Q85.606 21.867 85.958 23.055Q86.309 24.242 86.309 25.633V26.664H76.106Q76.106 28.18 76.395 29.414Q76.684 30.648 77.309 31.586Q77.919 32.492 78.903 33.016Q79.888 33.539 81.247 33.539Q82.638 33.539 83.645 32.891Q84.653 32.242 85.591 30.555ZM83.231 25.352Q83.231 24.477 83.083 23.477Q82.934 22.477 82.606 21.805Q82.247 21.086 81.622 20.633Q80.997 20.18 80.013 20.18Q78.372 20.18 77.286 21.547Q76.2 22.914 76.106 25.352Z M114.056 34.852H106.541V33.82Q106.9 33.789 107.267 33.758Q107.634 33.727 107.916 33.633Q108.353 33.492 108.564 33.141Q108.775 32.789 108.775 32.227V24.273Q108.775 22.648 108.033 21.766Q107.291 20.883 106.181 20.883Q105.416 20.883 104.744 21.117Q104.072 21.352 103.509 21.773Q103.056 22.117 102.752 22.516Q102.447 22.914 102.291 23.18V32.07Q102.291 32.617 102.478 32.969Q102.666 33.32 103.119 33.508Q103.478 33.648 103.767 33.719Q104.056 33.789 104.525 33.82V34.852H97.166V33.82Q97.525 33.789 97.861 33.758Q98.197 33.727 98.478 33.633Q98.916 33.492 99.127 33.141Q99.338 32.789 99.338 32.227V24.273Q99.338 22.648 98.595 21.766Q97.853 20.883 96.744 20.883Q95.978 20.883 95.306 21.125Q94.634 21.367 94.072 21.789Q93.619 22.133 93.306 22.562Q92.994 22.992 92.838 23.211V32.039Q92.838 32.57 93.056 32.93Q93.275 33.289 93.713 33.477Q94.041 33.633 94.384 33.711Q94.728 33.789 95.15 33.82V34.852H87.666V33.82Q88.025 33.789 88.408 33.758Q88.791 33.727 89.072 33.633Q89.509 33.492 89.72 33.141Q89.931 32.789 89.931 32.227V22.648Q89.931 22.148 89.705 21.75Q89.478 21.352 89.072 21.07Q88.775 20.883 88.338 20.766Q87.9 20.648 87.431 20.617V19.602L92.588 19.258L92.806 19.477V21.68H92.916Q93.306 21.289 93.869 20.758Q94.431 20.227 94.916 19.898Q95.463 19.523 96.283 19.273Q97.103 19.023 98.056 19.023Q99.556 19.023 100.634 19.828Q101.713 20.633 102.181 21.773Q102.744 21.227 103.173 20.812Q103.603 20.398 104.306 19.93Q104.9 19.523 105.705 19.273Q106.509 19.023 107.494 19.023Q109.447 19.023 110.588 20.305Q111.728 21.586 111.728 24.242V32.07Q111.728 32.617 111.916 32.969Q112.103 33.32 112.556 33.508Q112.916 33.648 113.267 33.719Q113.619 33.789 114.056 33.82Z M130.069 26.992Q130.069 28.617 129.553 30.188Q129.038 31.758 128.084 32.852Q127.006 34.102 125.584 34.711Q124.163 35.32 122.397 35.32Q120.928 35.32 119.6 34.766Q118.272 34.211 117.241 33.148Q116.225 32.102 115.623 30.594Q115.022 29.086 115.022 27.211Q115.022 23.602 117.123 21.305Q119.225 19.008 122.631 19.008Q125.866 19.008 127.967 21.188Q130.069 23.367 130.069 26.992ZM126.834 27.023Q126.834 25.852 126.6 24.547Q126.366 23.242 125.897 22.336Q125.397 21.367 124.584 20.781Q123.772 20.195 122.6 20.195Q121.397 20.195 120.545 20.789Q119.694 21.383 119.163 22.414Q118.663 23.367 118.459 24.586Q118.256 25.805 118.256 26.945Q118.256 28.445 118.498 29.719Q118.741 30.992 119.272 31.992Q119.803 32.992 120.608 33.562Q121.413 34.133 122.6 34.133Q124.553 34.133 125.694 32.242Q126.834 30.352 126.834 27.023Z M141.675 27.305Q142.316 27.867 142.659 28.602Q143.003 29.336 143.003 30.398Q143.003 32.539 141.402 33.898Q139.8 35.258 137.253 35.258Q135.909 35.258 134.777 34.773Q133.644 34.289 133.159 33.883L132.847 34.898H131.675L131.519 29.539H132.597Q132.722 30.148 133.128 30.961Q133.534 31.773 134.113 32.43Q134.722 33.117 135.573 33.586Q136.425 34.055 137.488 34.055Q138.988 34.055 139.8 33.375Q140.613 32.695 140.613 31.43Q140.613 30.773 140.355 30.297Q140.097 29.82 139.597 29.461Q139.081 29.102 138.331 28.812Q137.581 28.523 136.659 28.242Q135.925 28.023 135.027 27.641Q134.128 27.258 133.488 26.742Q132.8 26.195 132.363 25.398Q131.925 24.602 131.925 23.523Q131.925 21.633 133.331 20.32Q134.738 19.008 137.097 19.008Q138.003 19.008 138.948 19.242Q139.894 19.477 140.488 19.805L140.847 18.992H141.972L142.206 23.945H141.128Q140.8 22.289 139.714 21.25Q138.628 20.211 137.066 20.211Q135.784 20.211 135.05 20.852Q134.316 21.492 134.316 22.398Q134.316 23.102 134.558 23.57Q134.8 24.039 135.284 24.367Q135.753 24.68 136.464 24.953Q137.175 25.227 138.222 25.57Q139.253 25.898 140.167 26.336Q141.081 26.773 141.675 27.305Z"/>
+</svg>
diff --git a/README.md b/README.md
index 7a27d960e..ace42224e 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,6 @@
> ✨ Featured sponsor: [CodeRabbit — Industry-leading AI code reviews](https://coderabbit.link/usememos).
-# Memos
-
-<img src="./web/public/logo.webp" alt="" width="96" align="right">
+<h1 id="memos"><img src="./.github/assets/memos-wordmark.svg" alt="Memos" width="145" height="48"></h1>
**Your thoughts, your data, shared on your terms.**
diff --git a/web/index.html b/web/index.html
index 0f2e41db3..321a36eef 100644
--- a/web/index.html
+++ b/web/index.html
@@ -5,9 +5,9 @@
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
- <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
- <link rel="icon" type="image/webp" href="/logo.webp" />
- <link rel="manifest" href="/site.webmanifest" />
+ <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=celadon" />
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg?v=bird-blue" />
+ <link rel="manifest" href="/site.webmanifest?v=celadon" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#faf9f5" />
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#1d1f23" />
diff --git a/web/public/android-chrome-192x192.png b/web/public/android-chrome-192x192.png
index 778cf7561..c862c34b4 100644
Binary files a/web/public/android-chrome-192x192.png and b/web/public/android-chrome-192x192.png differ
diff --git a/web/public/android-chrome-512x512.png b/web/public/android-chrome-512x512.png
index 5fd83fff7..bf4e55515 100644
Binary files a/web/public/android-chrome-512x512.png and b/web/public/android-chrome-512x512.png differ
diff --git a/web/public/apple-touch-icon.png b/web/public/apple-touch-icon.png
index e81696329..8f09366eb 100644
Binary files a/web/public/apple-touch-icon.png and b/web/public/apple-touch-icon.png differ
diff --git a/web/public/favicon.svg b/web/public/favicon.svg
new file mode 100644
index 000000000..cdee1fa2d
--- /dev/null
+++ b/web/public/favicon.svg
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512" role="img" aria-label="Memos" color="#477FA8" fill="currentColor" stroke="currentColor" stroke-width="3" stroke-linejoin="round">
+<!-- A light stroke reinforces the official small mark at favicon sizes. -->
+<g transform="translate(256 256) scale(1.08) translate(-256 -256)"><g transform="translate(3.189 13.356) scale(1.522148 1.409396)"><path fill="currentColor" fill-rule="evenodd" d="M126 35 C142 26 162 27 178 35 C195 44 204 63 204 84 C205 102 197 116 197 130 C199 141 212 150 223 165 C242 187 250 221 248 247 Q247 261 240 264 C233 251 232 238 230 225 C227 196 217 173 202 154 C189 141 184 133 189 116 C194 103 196 89 193 78 C184 89 174 100 160 103 Q156 104 152 100 C145 122 133 145 130 167 C144 185 161 195 177 220 C198 248 207 278 201 300 Q198 310 191 311 C187 286 183 266 173 242 C163 219 145 202 129 188 L128 225 Q128 233 120 237 Q115 240 113 245 C114 261 120 279 125 294 Q126 303 119 297 C111 285 108 273 104 261 C96 278 97 299 104 318 Q106 326 99 323 C82 304 79 278 89 255 C97 243 107 231 119 225 C113 207 114 185 118 166 C125 142 136 119 145 95 Q147 87 139 82 L111 67 C104 78 94 85 88 89 Q84 91 87 85 C93 72 102 57 113 49 Q115 43 120 43 Q124 44 118 51 L115 56 L141 69 C145 58 146 46 151 40 Q156 37 156 45 C156 59 151 76 152 87 Q154 95 164 92 C178 87 188 76 188 69 C184 51 172 40 155 37 Q140 34 126 39 Q119 41 126 35 Z M161 139 C158 149 151 159 149 166 Q147 172 153 169 C160 166 168 160 168 155 Q168 148 164 141 Q162 136 161 139 Z M196 164 C190 179 187 194 183 205 Q182 210 186 216 C198 236 204 257 207 280 Q208 287 213 284 C225 258 216 232 205 212 Q201 206 201 198 C203 184 204 173 202 165 Q200 159 196 164 Z"/></g>
+</g></svg>
diff --git a/web/public/logo-small.svg b/web/public/logo-small.svg
new file mode 100644
index 000000000..a8bdbd294
--- /dev/null
+++ b/web/public/logo-small.svg
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512" role="img" aria-label="Memos" fill="currentColor">
+<style>:root{color:#262b2b}@media(prefers-color-scheme:dark){:root{color:#eae5d8}}</style>
+<rect width="512" height="512" fill="none" style="fill:var(--logo-background,none);rx:var(--logo-radius,0px)"/>
+<g transform="translate(3.189 13.356) scale(1.522148 1.409396)"><path fill="currentColor" fill-rule="evenodd" d="M126 35 C142 26 162 27 178 35 C195 44 204 63 204 84 C205 102 197 116 197 130 C199 141 212 150 223 165 C242 187 250 221 248 247 Q247 261 240 264 C233 251 232 238 230 225 C227 196 217 173 202 154 C189 141 184 133 189 116 C194 103 196 89 193 78 C184 89 174 100 160 103 Q156 104 152 100 C145 122 133 145 130 167 C144 185 161 195 177 220 C198 248 207 278 201 300 Q198 310 191 311 C187 286 183 266 173 242 C163 219 145 202 129 188 L128 225 Q128 233 120 237 Q115 240 113 245 C114 261 120 279 125 294 Q126 303 119 297 C111 285 108 273 104 261 C96 278 97 299 104 318 Q106 326 99 323 C82 304 79 278 89 255 C97 243 107 231 119 225 C113 207 114 185 118 166 C125 142 136 119 145 95 Q147 87 139 82 L111 67 C104 78 94 85 88 89 Q84 91 87 85 C93 72 102 57 113 49 Q115 43 120 43 Q124 44 118 51 L115 56 L141 69 C145 58 146 46 151 40 Q156 37 156 45 C156 59 151 76 152 87 Q154 95 164 92 C178 87 188 76 188 69 C184 51 172 40 155 37 Q140 34 126 39 Q119 41 126 35 Z M161 139 C158 149 151 159 149 166 Q147 172 153 169 C160 166 168 160 168 155 Q168 148 164 141 Q162 136 161 139 Z M196 164 C190 179 187 194 183 205 Q182 210 186 216 C198 236 204 257 207 280 Q208 287 213 284 C225 258 216 232 205 212 Q201 206 201 198 C203 184 204 173 202 165 Q200 159 196 164 Z"/></g>
+</svg>
diff --git a/web/public/logo.svg b/web/public/logo.svg
new file mode 100644
index 000000000..d18b1c7c4
--- /dev/null
+++ b/web/public/logo.svg
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512" role="img" aria-label="Memos" fill="currentColor">
+<style>:root{color:#262b2b}@media(prefers-color-scheme:dark){:root{color:#eae5d8}}</style>
+<rect width="512" height="512" fill="none" style="fill:var(--logo-background,none);rx:var(--logo-radius,0px)"/>
+<g transform="translate(17.067 28.624) scale(1.427919 1.322148)"><path fill="currentColor" fill-rule="evenodd" d="M126 35 C142 26 162 27 178 35 C195 44 204 63 204 84 C205 102 197 116 197 130 C199 141 212 150 223 165 C239 187 247 221 245 247 Q245 260 239 264 C233 251 232 238 230 225 C227 196 217 173 202 154 C189 141 184 133 189 116 C194 103 196 89 193 78 C184 89 174 100 160 103 Q156 104 152 100 C145 122 133 145 130 167 C144 185 161 195 177 220 C195 248 204 278 198 300 Q196 307 192 309 C187 286 183 266 173 242 C163 219 145 202 129 188 L128 225 Q128 233 120 237 Q115 240 113 245 C114 261 120 279 125 294 Q126 303 119 297 C111 285 108 273 104 261 C96 278 97 299 104 318 Q106 326 99 323 C86 304 82 278 92 256 C97 243 107 231 119 225 C116 207 117 185 121 166 C125 142 136 119 145 95 Q147 87 139 82 L111 67 C104 78 94 85 88 89 Q84 91 87 85 C93 72 102 57 113 49 Q115 43 120 43 Q124 44 118 51 L115 56 L141 69 C145 58 146 46 151 40 Q156 37 156 45 C156 59 151 76 152 87 Q154 95 164 92 C178 87 188 76 188 69 C184 51 172 40 155 37 Q140 34 126 39 Q119 41 126 35 Z M162 130 C157 145 150 158 147 168 Q146 172 151 170 L156 166 L162 151 L166 168 L158 181 Q155 186 160 185 C169 181 174 173 174 168 L167 144 Q163 125 162 130 Z M197 165 C192 179 190 194 186 205 Q185 209 188 212 C200 232 207 255 209 278 Q210 287 214 281 C222 256 214 234 202 214 Q198 206 198 198 C200 183 201 173 200 166 Q199 160 197 165 Z"/></g>
+</svg>
diff --git a/web/public/logo.webp b/web/public/logo.webp
index 522a5d9ec..b4792c6de 100644
Binary files a/web/public/logo.webp and b/web/public/logo.webp differ
diff --git a/web/public/site.webmanifest b/web/public/site.webmanifest
index 64cdbd381..fe5c3c83a 100644
--- a/web/public/site.webmanifest
+++ b/web/public/site.webmanifest
@@ -3,8 +3,8 @@
"short_name": "Memos",
"description": "Your own timeline for quick notes, private by default.",
"icons": [
- { "src": "/android-chrome-192x192.png", "sizes": "192x192", "type": "image/png" },
- { "src": "/android-chrome-512x512.png", "sizes": "512x512", "type": "image/png" }
+ { "src": "/android-chrome-192x192.png?v=celadon", "sizes": "192x192", "type": "image/png" },
+ { "src": "/android-chrome-512x512.png?v=celadon", "sizes": "512x512", "type": "image/png" }
],
"display": "standalone",
"scope": "/",
diff --git a/web/src/App.tsx b/web/src/App.tsx
index e5ea7de98..fbe60c4b2 100644
--- a/web/src/App.tsx
+++ b/web/src/App.tsx
@@ -6,6 +6,7 @@ import { TimelineViewProvider } from "./contexts/ViewContext";
import useNavigateTo from "./hooks/useNavigateTo";
import { useUserLocale } from "./hooks/useUserLocale";
import { useUserTheme } from "./hooks/useUserTheme";
+import { DEFAULT_FAVICON, getCustomLogoUrl } from "./lib/branding";
import { cleanupExpiredOAuthState } from "./utils/oauth";
const App = () => {
@@ -50,13 +51,22 @@ const App = () => {
// Dynamic update metadata with customized profile
useEffect(() => {
- if (!instanceGeneralSetting.customProfile) {
+ const customProfile = instanceGeneralSetting.customProfile;
+ document.title = customProfile?.title || "Memos";
+ const link = document.querySelector<HTMLLinkElement>("link[rel~='icon']");
+ if (!link) return;
+
+ const logoUrl = getCustomLogoUrl(customProfile?.logoUrl);
+ if (logoUrl) {
+ link.href = logoUrl;
+ // Custom images may be PNG, JPEG, or SVG; let the browser detect their type.
+ link.removeAttribute("type");
return;
}
- document.title = instanceGeneralSetting.customProfile.title;
- const link = document.querySelector("link[rel~='icon']") as HTMLLinkElement;
- link.href = instanceGeneralSetting.customProfile.logoUrl || "/logo.webp";
+ // A fixed blue stays visible when browser chrome differs from the system theme.
+ link.href = DEFAULT_FAVICON;
+ link.type = "image/svg+xml";
}, [instanceGeneralSetting.customProfile]);
return (
diff --git a/web/src/assets/full-logo.webp b/web/src/assets/full-logo.webp
deleted file mode 100644
index f654aae8a..000000000
Binary files a/web/src/assets/full-logo.webp and /dev/null differ
diff --git a/web/src/components/AppSidebar/SpaceSwitcher.tsx b/web/src/components/AppSidebar/SpaceSwitcher.tsx
index 25ef3d63b..26f13ae72 100644
--- a/web/src/components/AppSidebar/SpaceSwitcher.tsx
+++ b/web/src/components/AppSidebar/SpaceSwitcher.tsx
@@ -11,6 +11,7 @@ import {
import { useRef, useState } from "react";
import { Link, useLocation, useNavigate } from "react-router-dom";
import CreateSpaceDialog from "@/components/CreateSpaceDialog";
+import IdentityLabel from "@/components/IdentityLabel";
import MemosLogo from "@/components/MemosLogo";
import SpaceMark from "@/components/SpaceMark";
import SpaceSelectItem from "@/components/SpaceSelectItem";
@@ -101,48 +102,42 @@ function SpaceSwitcher({ className, size = "md" }: { className?: string; size?:
aria-label={`${t("space.switch")}: ${triggerLabel}`}
title={triggerLabel}
className={cn(
- "text-start transition-colors hover:bg-sidebar-accent/65 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/40",
+ "memos-brand-trigger text-start transition-colors hover:bg-sidebar-accent/65 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/40",
sidebarSurfaceVariants({ role: size === "header" ? "headerBrand" : "mobileBrand" }),
className,
)}
>
{showBrand ? (
- <MemosLogo compact size={size === "header" ? "header" : "md"} />
+ <MemosLogo size={size === "header" ? "header" : "md"} />
) : (
- <span className="flex min-w-0 items-center gap-2 overflow-hidden">
- {creatorUsername && selectedSpaceName ? (
- // With a Space selected, the creator recedes to its avatar (its name stays in the tooltip)
- // so the Space title keeps the width.
- <span className="flex shrink-0 items-center gap-1">
+ <IdentityLabel
+ label={creatorUsername && selectedSpaceName ? spaceLabel : contextLabel}
+ mark={
+ creatorUsername && selectedSpaceName ? (
+ // With a Space selected, the creator recedes to its avatar (its name stays in the tooltip)
+ // so the Space title keeps the width.
+ <span className="flex shrink-0 items-center gap-1">
+ <CreatorAvatar avatarUrl={selectedCreator?.avatarUrl} name={creatorLabel} size={size} />
+ <svg
+ aria-hidden="true"
+ viewBox="0 0 10 20"
+ className="h-5 w-2.5 shrink-0 text-muted-foreground/35"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth={1.25}
+ strokeLinecap="round"
+ >
+ <path d="M8 3 2 17" />
+ </svg>
+ <SpaceMark icon={selectedSpace?.icon} size={size === "header" ? "header" : "md"} />
+ </span>
+ ) : creatorUsername ? (
<CreatorAvatar avatarUrl={selectedCreator?.avatarUrl} name={creatorLabel} size={size} />
- <svg
- aria-hidden="true"
- viewBox="0 0 10 20"
- className="h-5 w-2.5 shrink-0 text-muted-foreground/35"
- fill="none"
- stroke="currentColor"
- strokeWidth={1.25}
- strokeLinecap="round"
- >
- <path d="M8 3 2 17" />
- </svg>
+ ) : (
<SpaceMark icon={selectedSpace?.icon} size={size === "header" ? "header" : "md"} />
- </span>
- ) : creatorUsername ? (
- <CreatorAvatar avatarUrl={selectedCreator?.avatarUrl} name={creatorLabel} size={size} />
- ) : (
- <SpaceMark icon={selectedSpace?.icon} size={size === "header" ? "header" : "md"} />
- )}
- <span
- data-sidebar-label
- className={cn(
- "min-w-0 truncate tracking-[-0.01em]",
- size === "header" ? "text-[15px] font-semibold leading-5" : "text-[14px] font-medium leading-4",
- )}
- >
- {creatorUsername && selectedSpaceName ? spaceLabel : contextLabel}
- </span>
- </span>
+ )
+ }
+ />
)}
<ChevronsUpDownIcon
aria-hidden="true"
diff --git a/web/src/components/AppSidebar/sidebar-layout.ts b/web/src/components/AppSidebar/sidebar-layout.ts
index 4759d461d..6ec43956e 100644
--- a/web/src/components/AppSidebar/sidebar-layout.ts
+++ b/web/src/components/AppSidebar/sidebar-layout.ts
@@ -16,7 +16,7 @@ export const SIDEBAR_NAV_LEADING_SLOT_CLASSES = "flex size-4 shrink-0 items-cent
/**
* Brand controls hug their content, ordinary rows fill the inset rail, and the account
* action fills the footer shell (or becomes a rail-aligned square when collapsed).
- * The header brand is the sidebar's title, not a row: a 24px mark on the artwork rail and
+ * The header brand is the sidebar's title, not a row: a 24px-tall mark on the artwork rail and
* a larger label, so it reads as a different kind of object from the 16px nav pills below.
* Heights stay fixed so data cannot change a surface's padding or vertical position.
*/
diff --git a/web/src/components/AuthPageLayout.tsx b/web/src/components/AuthPageLayout.tsx
index 9fca17452..1d6ecb91f 100644
--- a/web/src/components/AuthPageLayout.tsx
+++ b/web/src/components/AuthPageLayout.tsx
@@ -5,6 +5,7 @@ import { ROUTES } from "@/router/routes";
import { InstanceAccessMode } from "@/types/proto/api/instance_service_pb";
import { useTranslate } from "@/utils/i18n";
import AuthFooter from "./AuthFooter";
+import MemosLogo from "./MemosLogo";
interface Props {
chip?: React.ReactNode;
@@ -55,17 +56,14 @@ export const AuthOptionsLoading = () => <div className="h-9 w-full animate-pulse
const AuthPageLayout = ({ chip, title, subtitle, hideExplore, children }: Props) => {
const t = useTranslate();
- const { generalSetting, profile } = useInstance();
+ const { profile } = useInstance();
const showExplore = profile.accessMode === InstanceAccessMode.PUBLIC && !hideExplore;
return (
<div className="min-h-svh w-full flex flex-col items-center px-4 py-4 sm:py-8">
<div className="w-full grow flex flex-col justify-center items-center">
<div className="w-90 max-w-full rounded-xl border border-border bg-card p-7 shadow-sm">
- <div className="mb-6 flex items-center gap-2">
- <img className="h-6 w-auto rounded-full" src={generalSetting.customProfile?.logoUrl || "/logo.webp"} alt="" />
- <span className="text-sm font-semibold text-foreground">{generalSetting.customProfile?.title || "Memos"}</span>
- </div>
+ <MemosLogo size="lg" className="mb-8" />
{chip && <div className="mb-2">{chip}</div>}
<h1 className="text-lg font-semibold tracking-tight text-foreground">{title}</h1>
{subtitle && <p className="mt-1 text-sm text-muted-foreground">{subtitle}</p>}
diff --git a/web/src/components/IdentityLabel.tsx b/web/src/components/IdentityLabel.tsx
new file mode 100644
index 000000000..d79db911b
--- /dev/null
+++ b/web/src/components/IdentityLabel.tsx
@@ -0,0 +1,32 @@
+import type { ReactNode } from "react";
+import { cn } from "@/lib/utils";
+
+const TEXT_SCALE = { sm: "text-base", md: "text-lg", lg: "text-2xl", hero: "text-[2rem]" } as const;
+
+interface Props {
+ mark: ReactNode;
+ label: string;
+ size?: keyof typeof TEXT_SCALE;
+ collapsed?: boolean;
+ wrap?: boolean;
+ className?: string;
+}
+
+/** Shared mark and name typography for navigation and page branding. */
+const IdentityLabel = ({ mark, label, size = "md", collapsed, wrap, className }: Props) => (
+ <span
+ className={cn("flex min-w-0 items-center text-foreground", size === "hero" ? "gap-3" : size === "lg" ? "gap-2.5" : "gap-2", className)}
+ >
+ {mark}
+ {!collapsed && (
+ <span
+ className={cn("min-w-0", wrap ? "wrap-anywhere" : "truncate", TEXT_SCALE[size], "font-normal leading-[1.25] tracking-[-0.025em]")}
+ style={{ fontFamily: 'Georgia, "Times New Roman", Times, serif' }}
+ >
+ {label}
+ </span>
+ )}
+ </span>
+);
+
+export default IdentityLabel;
diff --git a/web/src/components/MemosLogo.tsx b/web/src/components/MemosLogo.tsx
index ab0b13a23..3ab547fa4 100644
--- a/web/src/components/MemosLogo.tsx
+++ b/web/src/components/MemosLogo.tsx
@@ -1,53 +1,62 @@
-import fullLogoUrl from "@/assets/full-logo.webp?no-inline";
import { useInstance } from "@/contexts/InstanceContext";
+import { getCustomLogoUrl } from "@/lib/branding";
import { cn } from "@/lib/utils";
-import UserAvatar from "./UserAvatar";
+import IdentityLabel from "./IdentityLabel";
+import { MemosMark } from "./MemosMark";
interface Props {
className?: string;
collapsed?: boolean;
- compact?: boolean;
- /** Scale of the compact lockup: "header" for primary chrome, "md" for roomy surfaces, and "sm" for dense menu rows. */
- size?: keyof typeof COMPACT_SCALE;
+ as?: "div" | "h1";
+ /** Navigation uses header/md; auth pages use lg and About uses hero. */
+ size?: keyof typeof LOGO_SCALE;
}
-// Kept in step with SpaceMark in SpaceSwitcher, so the brand and a Space read as peers
-// wherever the two are listed together.
-const COMPACT_SCALE = {
- md: { mark: "size-7 rounded-[7px]", gap: "gap-1.5", title: "text-[14px]", weight: "font-medium" },
- header: { mark: "size-6 rounded-[6px]", gap: "gap-2", title: "text-[15px] leading-5", weight: "font-semibold" },
- sm: { mark: "size-5 rounded-[5px]", gap: "gap-1.5", title: "text-ui", weight: "font-medium" },
+const LOGO_SCALE = {
+ sm: { mark: 20, text: "sm" },
+ header: { mark: 24, text: "md" },
+ md: { mark: 28, text: "md" },
+ lg: { mark: 32, text: "lg" },
+ hero: { mark: 48, text: "hero" },
} as const;
-function MemosLogo(props: Props) {
- const { collapsed, compact, size = "md" } = props;
- const scale = COMPACT_SCALE[size];
+function MemosLogo({ collapsed, size = "md", as: Component = "div", className }: Props) {
+ const scale = LOGO_SCALE[size];
const { generalSetting: instanceGeneralSetting } = useInstance();
const title = instanceGeneralSetting.customProfile?.title || "Memos";
- const avatarUrl = instanceGeneralSetting.customProfile?.logoUrl || fullLogoUrl;
+ const logoUrl = getCustomLogoUrl(instanceGeneralSetting.customProfile?.logoUrl);
return (
- <div className={cn("relative min-w-0 h-auto", props.className)}>
- <div
- className={cn(
- "flex min-w-0 flex-row items-center justify-start text-foreground",
- compact ? cn("px-0", scale.gap) : collapsed ? "px-1" : "gap-2 px-3",
- )}
- >
- {/* The instance logo is a brand, not a person, so it keeps a square mark. */}
- <UserAvatar className={cn("shrink-0", compact ? scale.mark : "rounded-xl")} avatarUrl={avatarUrl} />
- {!collapsed && (
- <span
- className={cn(
- "shrink truncate text-foreground",
- compact ? cn(scale.title, scale.weight, "tracking-[-0.01em]") : "text-lg font-medium",
- )}
- >
- {title}
- </span>
- )}
- </div>
- </div>
+ <Component className={cn("memos-logo w-fit min-w-0 max-w-full", className)}>
+ <IdentityLabel
+ label={title}
+ size={scale.text}
+ collapsed={collapsed}
+ wrap={size === "lg" || size === "hero"}
+ mark={
+ logoUrl ? (
+ <img
+ src={logoUrl}
+ width={scale.mark}
+ height={scale.mark}
+ style={{ width: scale.mark, height: scale.mark }}
+ className="shrink-0 select-none object-contain"
+ alt={collapsed ? title : ""}
+ draggable={false}
+ decoding="async"
+ />
+ ) : (
+ <MemosMark
+ size={scale.mark}
+ className="text-primary"
+ label={collapsed ? title : undefined}
+ // Like dotcom's lockup, trim transparent margins so the gap follows the visible bird.
+ {...(!collapsed ? { viewBox: "112 32 288 448", width: Math.ceil((scale.mark * 288) / 448) } : {})}
+ />
+ )
+ }
+ />
+ </Component>
);
}
diff --git a/web/src/components/MemosMark.tsx b/web/src/components/MemosMark.tsx
new file mode 100644
index 000000000..6d5a1ad59
--- /dev/null
+++ b/web/src/components/MemosMark.tsx
@@ -0,0 +1,47 @@
+import type { SVGProps } from "react";
+import { cn } from "@/lib/utils";
+
+// Exact paths from usememos/.github@5e3121450f5160c7b6b7c301379c27fedf7985d1.
+// The parity test keeps these inline, themeable marks aligned with the public SVGs.
+const shapes = {
+ standard: {
+ transform: "translate(17.067 28.624) scale(1.427919 1.322148)",
+ path: "M126 35 C142 26 162 27 178 35 C195 44 204 63 204 84 C205 102 197 116 197 130 C199 141 212 150 223 165 C239 187 247 221 245 247 Q245 260 239 264 C233 251 232 238 230 225 C227 196 217 173 202 154 C189 141 184 133 189 116 C194 103 196 89 193 78 C184 89 174 100 160 103 Q156 104 152 100 C145 122 133 145 130 167 C144 185 161 195 177 220 C195 248 204 278 198 300 Q196 307 192 309 C187 286 183 266 173 242 C163 219 145 202 129 188 L128 225 Q128 233 120 237 Q115 240 113 245 C114 261 120 279 125 294 Q126 303 119 297 C111 285 108 273 104 261 C96 278 97 299 104 318 Q106 326 99 323 C86 304 82 278 92 256 C97 243 107 231 119 225 C116 207 117 185 121 166 C125 142 136 119 145 95 Q147 87 139 82 L111 67 C104 78 94 85 88 89 Q84 91 87 85 C93 72 102 57 113 49 Q115 43 120 43 Q124 44 118 51 L115 56 L141 69 C145 58 146 46 151 40 Q156 37 156 45 C156 59 151 76 152 87 Q154 95 164 92 C178 87 188 76 188 69 C184 51 172 40 155 37 Q140 34 126 39 Q119 41 126 35 Z M162 130 C157 145 150 158 147 168 Q146 172 151 170 L156 166 L162 151 L166 168 L158 181 Q155 186 160 185 C169 181 174 173 174 168 L167 144 Q163 125 162 130 Z M197 165 C192 179 190 194 186 205 Q185 209 188 212 C200 232 207 255 209 278 Q210 287 214 281 C222 256 214 234 202 214 Q198 206 198 198 C200 183 201 173 200 166 Q199 160 197 165 Z",
+ },
+ small: {
+ transform: "translate(3.189 13.356) scale(1.522148 1.409396)",
+ path: "M126 35 C142 26 162 27 178 35 C195 44 204 63 204 84 C205 102 197 116 197 130 C199 141 212 150 223 165 C242 187 250 221 248 247 Q247 261 240 264 C233 251 232 238 230 225 C227 196 217 173 202 154 C189 141 184 133 189 116 C194 103 196 89 193 78 C184 89 174 100 160 103 Q156 104 152 100 C145 122 133 145 130 167 C144 185 161 195 177 220 C198 248 207 278 201 300 Q198 310 191 311 C187 286 183 266 173 242 C163 219 145 202 129 188 L128 225 Q128 233 120 237 Q115 240 113 245 C114 261 120 279 125 294 Q126 303 119 297 C111 285 108 273 104 261 C96 278 97 299 104 318 Q106 326 99 323 C82 304 79 278 89 255 C97 243 107 231 119 225 C113 207 114 185 118 166 C125 142 136 119 145 95 Q147 87 139 82 L111 67 C104 78 94 85 88 89 Q84 91 87 85 C93 72 102 57 113 49 Q115 43 120 43 Q124 44 118 51 L115 56 L141 69 C145 58 146 46 151 40 Q156 37 156 45 C156 59 151 76 152 87 Q154 95 164 92 C178 87 188 76 188 69 C184 51 172 40 155 37 Q140 34 126 39 Q119 41 126 35 Z M161 139 C158 149 151 159 149 166 Q147 172 153 169 C160 166 168 160 168 155 Q168 148 164 141 Q162 136 161 139 Z M196 164 C190 179 187 194 183 205 Q182 210 186 216 C198 236 204 257 207 280 Q208 287 213 284 C225 258 216 232 205 212 Q201 206 201 198 C203 184 204 173 202 165 Q200 159 196 164 Z",
+ },
+} as const;
+
+type MemosMarkProps = SVGProps<SVGSVGElement> & {
+ size?: number;
+ variant?: keyof typeof shapes;
+ label?: string;
+};
+
+/** Set color with CSS; size selects the official small mark at 32px or below. */
+export function MemosMark({ size = 32, variant = size <= 32 ? "small" : "standard", label, className, ...props }: MemosMarkProps) {
+ const shape = shapes[variant];
+
+ return (
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 512 512"
+ width={size}
+ height={size}
+ fill="currentColor"
+ role={label ? "img" : undefined}
+ aria-label={label}
+ aria-hidden={label ? undefined : true}
+ focusable="false"
+ className={cn("memos-mark shrink-0", className)}
+ {...props}
+ >
+ {label ? <title>{label}</title> : null}
+ <g transform={shape.transform}>
+ <path fill="currentColor" fillRule="evenodd" d={shape.path} />
+ </g>
+ </svg>
+ );
+}
diff --git a/web/src/components/UpdateCustomizedProfileDialog.tsx b/web/src/components/UpdateCustomizedProfileDialog.tsx
index 6f2c99553..511dc66e9 100644
--- a/web/src/components/UpdateCustomizedProfileDialog.tsx
+++ b/web/src/components/UpdateCustomizedProfileDialog.tsx
@@ -60,7 +60,7 @@ function UpdateCustomizedProfileDialog({ open, onOpenChange, onSuccess }: Props)
const handleRestoreButtonClick = () => {
setPartialState({
title: "Memos",
- logoUrl: "/logo.webp",
+ logoUrl: "",
description: "",
});
};
diff --git a/web/src/index.css b/web/src/index.css
index bcc176416..606dcffdc 100644
--- a/web/src/index.css
+++ b/web/src/index.css
@@ -39,6 +39,17 @@
}
@layer components {
+ @media (prefers-reduced-motion: no-preference) {
+ .memos-logo .memos-mark {
+ transition: transform 180ms ease-out;
+ }
+
+ .memos-brand-trigger:is(:hover, :focus-visible) .memos-mark,
+ .memos-logo:hover .memos-mark {
+ transform: translateY(-1px) rotate(-6deg);
+ }
+ }
+
.map-attribution-minimal .leaflet-control-attribution {
margin: 0 0.25rem 0.25rem 0 !important;
border-radius: 0.25rem;
diff --git a/web/src/lib/branding.ts b/web/src/lib/branding.ts
new file mode 100644
index 000000000..72afc252d
--- /dev/null
+++ b/web/src/lib/branding.ts
@@ -0,0 +1,6 @@
+export const DEFAULT_FAVICON = "/favicon.svg?v=bird-blue";
+
+// Earlier versions persisted /logo.webp when restoring the default profile.
+// Treat built-in URLs as defaults so those instances also get the themeable SVG.
+export const getCustomLogoUrl = (logoUrl?: string): string | undefined =>
+ !logoUrl || logoUrl === "/logo.webp" || logoUrl === "/logo.svg" ? undefined : logoUrl;
diff --git a/web/src/pages/About.tsx b/web/src/pages/About.tsx
index 8b2d2cfa5..165dacf2f 100644
--- a/web/src/pages/About.tsx
+++ b/web/src/pages/About.tsx
@@ -1,4 +1,5 @@
import { BookOpenIcon, CodeXmlIcon, ExternalLinkIcon, GitForkIcon, GlobeIcon, HeartIcon, ScissorsIcon } from "lucide-react";
+import MemosLogo from "@/components/MemosLogo";
import { Badge } from "@/components/ui/badge";
import { useInstance } from "@/contexts/InstanceContext";
import {
@@ -15,7 +16,6 @@ const GITHUB_COMMIT_URL_PREFIX = "https://github.com/usememos/memos/commit/";
const GITHUB_RELEASE_URL_PREFIX = "https://github.com/usememos/memos/releases/tag/";
const DEFAULT_TITLE = "Memos";
-const DEFAULT_LOGO = "/logo.webp";
const isCommitSha = (commit: string) => /^[0-9a-f]{7,40}$/i.test(commit);
@@ -46,7 +46,6 @@ const About = () => {
const customProfile = generalSetting.customProfile;
const instanceTitle = customProfile?.title || DEFAULT_TITLE;
- const instanceLogo = customProfile?.logoUrl || DEFAULT_LOGO;
const isCustomBranded = instanceTitle !== DEFAULT_TITLE;
const releaseTag = getReleaseTag(profile.version);
@@ -86,27 +85,21 @@ const About = () => {
<div className="@container mx-auto w-full max-w-5xl py-8 sm:py-16">
<div className="grid gap-10 @min-[52rem]:grid-cols-[minmax(0,0.9fr)_minmax(0,1.5fr)] @min-[52rem]:gap-8">
<header className="min-w-0 @min-[52rem]:border-e @min-[52rem]:border-border @min-[52rem]:pe-8 @min-[52rem]:pt-7">
- <div className="flex items-center gap-4">
- <img
- className="size-16 shrink-0 select-none rounded-xl object-contain @min-[60rem]:size-20"
- src={instanceLogo}
- alt=""
- draggable={false}
- />
- <div className="flex min-w-0 flex-wrap items-center gap-2.5">
- <h1 className="text-3xl font-semibold tracking-tight wrap-anywhere text-foreground @min-[60rem]:text-4xl">
- {instanceTitle}
- </h1>
- {profile.version && (
- <Chip href={releaseUrl || undefined}>
- <span className="sr-only">{t("common.version")} </span>
- {versionLabel}
- </Chip>
- )}
- {profile.demo && <Badge variant="warning">{t("about.demo")}</Badge>}
- </div>
+ <div className="space-y-3">
+ <MemosLogo as="h1" size="hero" />
+ {(profile.version || profile.demo) && (
+ <div className="flex min-w-0 flex-wrap items-center gap-2.5">
+ {profile.version && (
+ <Chip href={releaseUrl || undefined}>
+ <span className="sr-only">{t("common.version")} </span>
+ {versionLabel}
+ </Chip>
+ )}
+ {profile.demo && <Badge variant="warning">{t("about.demo")}</Badge>}
+ </div>
+ )}
</div>
- <p className="mt-8 text-4xl leading-[1.15] tracking-tight wrap-anywhere text-foreground @min-[60rem]:text-[3.25rem]">
+ <p className="mt-6 text-4xl leading-[1.15] tracking-tight wrap-anywhere text-foreground @min-[60rem]:text-[3.25rem]">
{customProfile?.description || (
<>
<span className="block">Your thoughts, your data,</span> <span className="block">shared on your terms.</span>
diff --git a/web/tests/about-page.test.tsx b/web/tests/about-page.test.tsx
index 948718367..51ebb7b61 100644
--- a/web/tests/about-page.test.tsx
+++ b/web/tests/about-page.test.tsx
@@ -50,6 +50,8 @@ describe("<About>", () => {
renderAbout();
expect(screen.getByRole("heading", { name: "Memos" })).toBeInTheDocument();
+ expect(document.querySelector(".memos-mark")).toHaveAttribute("fill", "currentColor");
+ expect(document.querySelector(".memos-mark")).toHaveAttribute("height", "48");
expect(screen.getByText(/Your thoughts, your data/i)).toBeInTheDocument();
expect(screen.getByText("about.description")).toBeInTheDocument();
expect(screen.getByRole("link", { name: /Version\s*v0\.25\.0/ })).toHaveAttribute(
diff --git a/web/tests/app-branding.test.tsx b/web/tests/app-branding.test.tsx
new file mode 100644
index 000000000..8ab3dd2bc
--- /dev/null
+++ b/web/tests/app-branding.test.tsx
@@ -0,0 +1,94 @@
+import { act, render } from "@testing-library/react";
+import type { ReactNode } from "react";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import App from "@/App";
+
+const instance = vi.hoisted(() => ({
+ profile: {},
+ generalSetting: { customProfile: undefined as { title: string; logoUrl: string } | undefined },
+}));
+
+vi.mock("@/contexts/InstanceContext", () => ({ useInstance: () => instance }));
+vi.mock("@/contexts/ViewContext", () => ({ TimelineViewProvider: ({ children }: { children: ReactNode }) => children }));
+vi.mock("@/hooks/useNavigateTo", () => ({ default: () => vi.fn() }));
+vi.mock("@/hooks/useUserLocale", () => ({ useUserLocale: () => "ltr" }));
+vi.mock("@/hooks/useUserTheme", () => ({ useUserTheme: vi.fn() }));
+vi.mock("@/utils/oauth", () => ({ cleanupExpiredOAuthState: vi.fn() }));
+vi.mock("react-router-dom", () => ({ Outlet: () => null, ScrollRestoration: () => null }));
+
+describe("instance favicon", () => {
+ let icon: HTMLLinkElement;
+ let colorScheme: MediaQueryList;
+
+ beforeEach(() => {
+ instance.generalSetting.customProfile = undefined;
+ colorScheme = Object.assign(new EventTarget(), {
+ matches: false,
+ media: "(prefers-color-scheme: dark)",
+ onchange: null,
+ addListener: vi.fn(),
+ removeListener: vi.fn(),
+ });
+ vi.stubGlobal(
+ "matchMedia",
+ vi.fn(() => colorScheme),
+ );
+ icon = document.createElement("link");
+ icon.rel = "icon";
+ icon.type = "image/svg+xml";
+ document.head.appendChild(icon);
+ });
+
+ afterEach(() => {
+ icon.remove();
+ vi.unstubAllGlobals();
+ });
+
+ it.each(["", "/logo.webp", "/logo.svg"])("uses the SVG favicon for built-in logo %s", (logoUrl) => {
+ instance.generalSetting.customProfile = { title: "Memos", logoUrl };
+ render(<App />);
+
+ expect(icon).toHaveAttribute("href", "/favicon.svg?v=bird-blue");
+ expect(icon).toHaveAttribute("type", "image/svg+xml");
+ });
+
+ it("preserves custom image formats and restores the default when branding is cleared", () => {
+ instance.generalSetting.customProfile = { title: "Team Notes", logoUrl: "/custom.png" };
+ const { rerender } = render(<App />);
+
+ expect(document.title).toBe("Team Notes");
+ expect(icon).toHaveAttribute("href", "/custom.png");
+ expect(icon).not.toHaveAttribute("type");
+
+ act(() => {
+ Object.assign(colorScheme, { matches: true });
+ colorScheme.dispatchEvent(new Event("change"));
+ });
+ expect(icon).toHaveAttribute("href", "/custom.png");
+
+ instance.generalSetting.customProfile = undefined;
+ rerender(<App />);
+
+ expect(document.title).toBe("Memos");
+ expect(icon).toHaveAttribute("href", "/favicon.svg?v=bird-blue");
+ expect(icon).toHaveAttribute("type", "image/svg+xml");
+ });
+
+ it("keeps the same favicon across system color schemes", () => {
+ Object.assign(colorScheme, { matches: true });
+ render(<App />);
+ expect(icon).toHaveAttribute("href", "/favicon.svg?v=bird-blue");
+
+ act(() => {
+ Object.assign(colorScheme, { matches: false });
+ colorScheme.dispatchEvent(new Event("change"));
+ });
+ expect(icon).toHaveAttribute("href", "/favicon.svg?v=bird-blue");
+
+ act(() => {
+ Object.assign(colorScheme, { matches: true });
+ colorScheme.dispatchEvent(new Event("change"));
+ });
+ expect(icon).toHaveAttribute("href", "/favicon.svg?v=bird-blue");
+ });
+});
diff --git a/web/tests/auth-page-layout.test.tsx b/web/tests/auth-page-layout.test.tsx
index 353675ace..042b3f58e 100644
--- a/web/tests/auth-page-layout.test.tsx
+++ b/web/tests/auth-page-layout.test.tsx
@@ -5,9 +5,10 @@ import AuthPageLayout from "@/components/AuthPageLayout";
import { InstanceAccessMode } from "@/types/proto/api/instance_service_pb";
const instance = vi.hoisted(() => ({ instanceUrl: "https://notes.example.com", accessMode: 1 }));
+const settings = vi.hoisted(() => ({ customProfile: undefined as { title?: string; logoUrl?: string } | undefined }));
vi.mock("@/contexts/InstanceContext", () => ({
- useInstance: () => ({ profile: instance, generalSetting: {} }),
+ useInstance: () => ({ profile: instance, generalSetting: settings }),
}));
vi.mock("@/utils/i18n", () => ({
@@ -29,6 +30,7 @@ const renderLayout = (props?: { hideExplore?: boolean }) =>
describe("<AuthPageLayout> explore band", () => {
beforeEach(() => {
instance.accessMode = InstanceAccessMode.PRIVATE;
+ settings.customProfile = undefined;
});
it("links to Explore on public instances", () => {
@@ -50,4 +52,22 @@ describe("<AuthPageLayout> explore band", () => {
expect(screen.queryByRole("link", { name: /auth\.explore-public-memos/ })).not.toBeInTheDocument();
});
+
+ it.each([undefined, "/logo.webp"])("uses a themeable small logo for the default %s", (logoUrl) => {
+ settings.customProfile = { logoUrl };
+ const { container } = renderLayout();
+
+ expect(container.querySelector(".memos-mark")).toHaveAttribute("height", "32");
+ expect(screen.getByText("Memos")).toBeInTheDocument();
+ expect(container.querySelector("img")).toBeNull();
+ });
+
+ it("preserves custom logos and titles", () => {
+ settings.customProfile = { title: "Team Notes", logoUrl: "/custom-logo.svg" };
+ const { container } = renderLayout();
+
+ expect(container.querySelector("img")).toHaveAttribute("src", "/custom-logo.svg");
+ expect(container.querySelector(".memos-mark")).toBeNull();
+ expect(screen.getByText("Team Notes")).toBeInTheDocument();
+ });
});
diff --git a/web/tests/memos-logo.test.tsx b/web/tests/memos-logo.test.tsx
index 9b5b74838..a49547489 100644
--- a/web/tests/memos-logo.test.tsx
+++ b/web/tests/memos-logo.test.tsx
@@ -1,7 +1,9 @@
import { render, screen } from "@testing-library/react";
import { beforeEach, describe, expect, it, vi } from "vitest";
-import fullLogoUrl from "@/assets/full-logo.webp?no-inline";
import MemosLogo from "@/components/MemosLogo";
+import { MemosMark } from "@/components/MemosMark";
+import standardSource from "../public/logo.svg?raw";
+import smallSource from "../public/logo-small.svg?raw";
const mockInstance = {
generalSetting: {} as { customProfile?: { title?: string; logoUrl?: string } },
@@ -16,18 +18,49 @@ describe("<MemosLogo>", () => {
mockInstance.generalSetting = {};
});
- it("uses the bundled logo when the instance has no custom logo", () => {
+ it.each([undefined, "", "/logo.webp", "/logo.svg"])("uses the inline logo for the built-in URL %s", (logoUrl) => {
+ mockInstance.generalSetting = { customProfile: { logoUrl } };
const { container } = render(<MemosLogo />);
- expect(container.querySelector("img")).toHaveAttribute("src", fullLogoUrl);
+ expect(container.querySelector("img")).toBeNull();
+ expect(container.querySelector("svg")).toHaveAttribute("fill", "currentColor");
+ expect(container.querySelector("svg")).toHaveAttribute("aria-hidden", "true");
expect(screen.getByText("Memos")).toBeInTheDocument();
});
- it("uses custom instance branding when configured", () => {
- mockInstance.generalSetting = { customProfile: { title: "Team Notes", logoUrl: "/custom-logo.png" } };
+ it.each(["/custom-logo.png", "/custom-logo.svg", "https://example.com/logo.webp"])("preserves custom branding at %s", (logoUrl) => {
+ mockInstance.generalSetting = { customProfile: { title: "Team Notes", logoUrl } };
const { container } = render(<MemosLogo />);
- expect(container.querySelector("img")).toHaveAttribute("src", "/custom-logo.png");
+ expect(container.querySelector("img")).toHaveAttribute("src", logoUrl);
+ expect(container.querySelector(".memos-mark")).toBeNull();
expect(screen.getByText("Team Notes")).toBeInTheDocument();
});
+
+ it("names the standalone mark when the title is collapsed", () => {
+ render(<MemosLogo collapsed />);
+
+ expect(screen.getByRole("img", { name: "Memos" })).toBeInTheDocument();
+ });
+
+ it("names a custom standalone logo when the title is collapsed", () => {
+ mockInstance.generalSetting = { customProfile: { title: "Team Notes", logoUrl: "/custom-logo.svg" } };
+ render(<MemosLogo collapsed />);
+
+ expect(screen.getByRole("img", { name: "Team Notes" })).toHaveAttribute("src", "/custom-logo.svg");
+ });
+});
+
+describe("<MemosMark>", () => {
+ // Keep the inline paths aligned with the vendored upstream SVGs.
+ it.each([20, 24, 28, 32, 33, 48, 64])("uses the official contour at %ipx", (size) => {
+ const source = new DOMParser().parseFromString(size <= 32 ? smallSource : standardSource, "image/svg+xml");
+ const { container } = render(<MemosMark size={size} />);
+
+ expect(container.querySelector("svg")).toHaveAttribute("width", String(size));
+ expect(container.querySelector("svg")).toHaveAttribute("height", String(size));
+ expect(container.querySelector("g")).toHaveAttribute("transform", source.querySelector("g")?.getAttribute("transform"));
+ expect(container.querySelector("path")).toHaveAttribute("d", source.querySelector("path")?.getAttribute("d"));
+ expect(container.querySelector("path")).toHaveAttribute("fill-rule", "evenodd");
+ });
});
diff --git a/web/tests/space-switcher.test.tsx b/web/tests/space-switcher.test.tsx
index 7e632978d..ba5bf6f61 100644
--- a/web/tests/space-switcher.test.tsx
+++ b/web/tests/space-switcher.test.tsx
@@ -18,7 +18,7 @@ const state = vi.hoisted(() => ({
setMobileOpen: vi.fn(),
}));
-vi.mock("@/components/MemosLogo", () => ({ default: () => <span>Memos</span> }));
+vi.mock("@/contexts/InstanceContext", () => ({ useInstance: () => ({ generalSetting: {} }) }));
vi.mock("@/components/UserMenu", () => ({
default: () => <button type="button">Steven account</button>,
}));