Skip to content

Commit b7ebec6

Browse files
rodrigocorreiaistsusnux
authored andcommitted
fix: #57282: icon color mismatch on download button in public share
The download button icon on the public share page always appeared in the opposite color of the button text. The root cause was the wrong CSS variable for the filter applied to the icon. Background-image icons are dark (black) by default. In light mode, the icon must be inverted to white when the primary color is dark, which requires --primary-invert-if-dark. The code was incorrectly using --primary-invert-if-bright, inverting in the wrong direction. In dark mode, icons.css swaps the icon variables so that --icon-download-dark resolves to the white SVG. The filter logic must be reversed: --primary-invert-if-bright is needed to invert the white icon to black when the primary color is bright. Fix by using --primary-invert-if-dark in light mode and --primary-invert-if-bright in dark mode, handling both the prefers-color-scheme media query and the Nextcloud data-themes attribute for explicit theme selection. Signed-off-by: Rodrigo Mendes Correia <rodrigo.mendes.correia@tecnico.ulisboa.pt>
1 parent 728644d commit b7ebec6

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

core/src/views/PublicPageMenu.vue

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,23 @@ function openDialogIfNeeded() {
135135
}
136136
137137
&__primary-icon {
138-
filter: var(--primary-invert-if-bright);
138+
// Light mode: icon is black by default, invert to white when primary is dark
139+
filter: var(--primary-invert-if-dark);
140+
141+
// Dark mode: icon is white (swapped in icons.css), invert to black when primary is bright
142+
@media (prefers-color-scheme: dark) {
143+
filter: var(--primary-invert-if-bright);
144+
}
139145
}
140146
}
147+
148+
// Dark theme via Nextcloud setting (data-themes attribute, not media query)
149+
:global([data-themes*=dark]) .public-page-menu__primary-icon {
150+
filter: var(--primary-invert-if-bright);
151+
}
152+
153+
// Light theme explicitly set (overrides dark media query if system is dark but user chose light)
154+
:global([data-themes*=light]) .public-page-menu__primary-icon {
155+
filter: var(--primary-invert-if-dark);
156+
}
141157
</style>

0 commit comments

Comments
 (0)