Skip to content

Commit ab5ccb7

Browse files
authored
Merge pull request #7238 from nextcloud/bugfix/noid/activity-icons
fix(darkmode): Fix activity icon colors
2 parents f054cc2 + 1a6e592 commit ab5ccb7

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/components/ActivityEntry.vue

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<template>
77
<div v-if="activity" class="activity">
88
<div class="activity--header">
9-
<img :src="activity.icon" class="activity--icon">
9+
<img :src="activity.icon" class="activity--icon" :class="applyMonochromeIconColor">
1010
<NcRichText class="activity--subject" :text="message.subject" :arguments="message.parameters" />
1111
<div class="activity--timestamp" :name="formatReadableDate(activity.datetime)">
1212
{{ relativeDate(activity.datetime) }}
@@ -94,6 +94,15 @@ export default {
9494
}
9595
},
9696
97+
applyMonochromeIconColor() {
98+
// copied from https://github.com/nextcloud/activity/blob/db919d45c45356082b17104614018e2c7e691996/js/script.js#L225
99+
const monochromeIcon = this.activity.type !== 'file_created' && this.activity.type !== 'file_deleted' && this.activity.type !== 'favorite' && !this.activity.icon.endsWith('-color.svg')
100+
if (monochromeIcon) {
101+
return 'monochrome'
102+
}
103+
return ''
104+
},
105+
97106
sanitizedMessage() {
98107
return DOMPurify.sanitize(this.activity.message, { ALLOWED_TAGS: ['ins', 'del'], ALLOWED_ATTR: ['class'] })
99108
},
@@ -115,6 +124,12 @@ export default {
115124
height: 16px;
116125
flex-shrink: 0;
117126
flex-grow: 0;
127+
128+
/* colored icons, in addition to core ones */
129+
&.monochrome {
130+
opacity: 0.8;
131+
filter: var(--background-invert-if-dark);
132+
}
118133
}
119134
.activity--subject {
120135
margin-left: 10px;

0 commit comments

Comments
 (0)