Skip to content

Fix #57282: icon color mismatch on download button in public share#59175

Open
rodrigocorreiaist wants to merge 1 commit intonextcloud:masterfrom
rodrigocorreiaist:fix/57282-download-button-icon-color
Open

Fix #57282: icon color mismatch on download button in public share#59175
rodrigocorreiaist wants to merge 1 commit intonextcloud:masterfrom
rodrigocorreiaist:fix/57282-download-button-icon-color

Conversation

@rodrigocorreiaist
Copy link

Summary

Fixes #57282

The download button icon on the public share page always appeared in the opposite color of the button text.

Root cause

The icon uses a CSS background-image (.icon-download) which is dark (black) by default. The filter var(--primary-invert-if-bright) was applied to it, but this variable inverts the icon in the wrong direction:

  • Light mode (dark primary color): --primary-invert-if-bright = no → icon stays black, but text is white → mismatch ❌
  • Dark mode (bright primary color): --primary-invert-if-bright = invert(100%) → icon becomes white, but text is black → mismatch ❌

Fix

In light mode, the correct variable is --primary-invert-if-dark, which inverts the dark icon to white when the primary color is dark (matching the white text).

In dark mode, icons.css swaps the icon CSS variables so that --icon-download-dark resolves to the white SVG. This means the filter logic must be reversed: --primary-invert-if-bright correctly inverts the white icon to black when the primary color is bright (matching the black text).

Both the prefers-color-scheme: dark media query and the Nextcloud data-themes attribute (used for explicit theme selection in Settings) are handled.

… 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>
@rodrigocorreiaist rodrigocorreiaist requested a review from a team as a code owner March 24, 2026 14:58
@rodrigocorreiaist rodrigocorreiaist requested review from nfebe, skjnldsv and szaimen and removed request for a team March 24, 2026 14:58
@szaimen szaimen requested a review from susnux March 25, 2026 11:36
@szaimen szaimen added bug design Design, UI, UX, etc. 3. to review Waiting for reviews labels Mar 25, 2026
@szaimen szaimen added this to the Nextcloud 34 milestone Mar 25, 2026
@szaimen
Copy link
Contributor

szaimen commented Mar 25, 2026

/backport to stable33

@szaimen
Copy link
Contributor

szaimen commented Mar 25, 2026

/backport to stable32

@szaimen
Copy link
Contributor

szaimen commented Mar 25, 2026

/compile rebase

@szaimen
Copy link
Contributor

szaimen commented Mar 25, 2026

@rodrigocorreiaist thanks for the PR! Can you please provide before and after screenshots? Also, can you please commit and push the compiled assets? Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews backport-request bug design Design, UI, UX, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Public share download button icon color

2 participants