Skip to content

Commit

Permalink
fix(conversations): Make avatars dark in dark mode again
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
  • Loading branch information
nickvergessen authored and Antreesy committed Mar 18, 2024
1 parent a330ccc commit 7255d4f
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 23 deletions.
4 changes: 2 additions & 2 deletions img/icon-conversation-federation-dark.svg
Loading
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
Loading
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
Loading
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
Loading
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
Loading
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
Loading
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
Loading
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
Loading
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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"

0 comments on commit 7255d4f

Please sign in to comment.