Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(conversations): Make avatars dark in dark mode again #11840

Merged
merged 1 commit into from Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions img/icon-conversation-federation-dark.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions img/icon-conversation-group-dark.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions img/icon-conversation-mail-dark.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions img/icon-conversation-password-dark.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions img/icon-conversation-phone-dark.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions img/icon-conversation-public-dark.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions img/icon-conversation-text-dark.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions img/icon-conversation-user-dark.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lib/Service/AvatarService.php
Expand Up @@ -43,7 +43,7 @@

class AvatarService {
public const THEMING_PLACEHOLDER = '{{THEMING}}';
public const THEMING_DARK_BACKGROUND = '999999';
public const THEMING_DARK_BACKGROUND = '3B3B3B';
public const THEMING_BRIGHT_BACKGROUND = '6B6B6B';

public function __construct(
Expand Down
13 changes: 10 additions & 3 deletions src/components/ConversationIcon.vue
Expand Up @@ -22,7 +22,7 @@
<template>
<div class="conversation-icon"
:style="{'--icon-size': `${size}px`}"
:class="{'offline': offline}">
:class="[themeClass, {'offline': offline}]">
<template v-if="!isOneToOne">
<div v-if="iconClass"
class="avatar icon"
Expand Down Expand Up @@ -181,8 +181,7 @@ export default {
// Also used in new conversation / invitation handler dialog
const isFed = this.item.remoteServer && 'icon-conversation-federation'
const type = this.item.type === CONVERSATION.TYPE.PUBLIC ? 'icon-conversation-public' : 'icon-conversation-group'
const theme = isDarkTheme ? 'dark' : 'bright'
return `${isFed || type} icon--dummy icon--${theme}`
return `${isFed || type} icon--dummy`
}

if (!supportsAvatar) {
Expand Down Expand Up @@ -220,6 +219,10 @@ export default {
return undefined
},

themeClass() {
return `conversation-icon--${isDarkTheme ? 'dark' : 'bright'}`
},

isOneToOne() {
return this.item.type === CONVERSATION.TYPE.ONE_TO_ONE
},
Expand Down Expand Up @@ -267,6 +270,10 @@ export default {
}
}

&--dark .avatar.icon {
background-color: #3B3B3B;
}

&__type {
position: absolute;
right: -4px;
Expand Down
11 changes: 10 additions & 1 deletion src/components/ConversationSettings/ConversationAvatarEditor.vue
Expand Up @@ -26,7 +26,7 @@
<div class="avatar__container">
<div v-if="!showCropper" class="avatar__preview">
<div v-if="emojiAvatar"
class="avatar__preview-emoji"
:class="['avatar__preview-emoji', themeClass]"
:style="{'background-color': backgroundColor}">
{{ emojiAvatar }}
</div>
Expand Down Expand Up @@ -141,6 +141,7 @@ import NcEmojiPicker from '@nextcloud/vue/dist/Components/NcEmojiPicker.js'
import ConversationIcon from '../ConversationIcon.vue'

import { AVATAR } from '../../constants.js'
import { isDarkTheme } from '../../utils/isDarkTheme.js'

// eslint-disable-next-line n/no-extraneous-import
import 'cropperjs/dist/cropper.css'
Expand Down Expand Up @@ -228,6 +229,10 @@ export default {
return this.conversation.isCustomAvatar
},

themeClass() {
return `avatar__preview-emoji--${isDarkTheme ? 'dark' : 'bright'}`
},

showControls() {
return this.editable && (this.showCropper || this.emojiAvatar)
},
Expand Down Expand Up @@ -434,6 +439,10 @@ section {
background-color: var(--color-text-maxcontrast);
font-size: 575%;
line-height: 100%;

&--dark {
background-color: #3B3B3B;
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/features/conversation-1/avatar.feature
Expand Up @@ -150,7 +150,7 @@ Feature: conversation/avatar
Then user "participant1" sets emoji "๐Ÿ" with color "null" as avatar of room "room" with 200 (v1)
And the avatar svg of room "room" contains the string "๐Ÿ"
And the avatar svg of room "room" contains the string "6B6B6B"
And the avatar svg of room "room" not contains the string "999999"
And the avatar svg of room "room" not contains the string "3B3B3B"
And the dark avatar svg of room "room" contains the string "๐Ÿ"
And the dark avatar svg of room "room" not contains the string "6B6B6B"
And the dark avatar svg of room "room" contains the string "999999"
And the dark avatar svg of room "room" contains the string "3B3B3B"