diff options
author | skjnldsv <skjnldsv@protonmail.com> | 2024-06-06 19:36:19 +0200 |
---|---|---|
committer | skjnldsv <skjnldsv@protonmail.com> | 2024-06-12 10:27:29 +0200 |
commit | 8bed23288b781db22c0825df7fac9f5312fbf6c4 (patch) | |
tree | bb4ace2d7cbca2c59402e7d04e30246ec1c9000f /apps/files_sharing/src | |
parent | 4a77fe3530d3213a2700b8ecdc1ccf3b4195b41a (diff) | |
download | nextcloud-server-8bed23288b781db22c0825df7fac9f5312fbf6c4.tar.gz nextcloud-server-8bed23288b781db22c0825df7fac9f5312fbf6c4.zip |
fix(files_sharing): dark avatar support
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files_sharing/src')
-rw-r--r-- | apps/files_sharing/src/actions/sharingStatusAction.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/apps/files_sharing/src/actions/sharingStatusAction.ts b/apps/files_sharing/src/actions/sharingStatusAction.ts index f048de1c4fe..55e2bf21e8f 100644 --- a/apps/files_sharing/src/actions/sharingStatusAction.ts +++ b/apps/files_sharing/src/actions/sharingStatusAction.ts @@ -17,8 +17,12 @@ import { getCurrentUser } from '@nextcloud/auth' import './sharingStatusAction.scss' +const isDarkMode = window?.matchMedia?.('(prefers-color-scheme: dark)')?.matches === true + || document.querySelector('[data-themes*=dark]') !== null + const generateAvatarSvg = (userId: string, isGuest = false) => { - const avatarUrl = generateUrl(isGuest ? '/avatar/guest/{userId}/32' : '/avatar/{userId}/32?guestFallback=true', { userId }) + const url = isDarkMode ? '/avatar/{userId}/32/dark' : '/avatar/{userId}/32' + const avatarUrl = generateUrl(isGuest ? url : url + '?guestFallback=true', { userId }) return `<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg" class="sharing-status__avatar"> <image href="${avatarUrl}" height="32" width="32" /> |