Skip to content

fix(sharing): icon color mismatch on download button in public share#59175

Open
rodrigocorreiaist wants to merge 4 commits into
nextcloud:masterfrom
rodrigocorreiaist:fix/57282-download-button-icon-color
Open

fix(sharing): icon color mismatch on download button in public share#59175
rodrigocorreiaist wants to merge 4 commits into
nextcloud:masterfrom
rodrigocorreiaist:fix/57282-download-button-icon-color

Conversation

@rodrigocorreiaist
Copy link
Copy Markdown

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.

@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
Copy Markdown
Contributor

szaimen commented Mar 25, 2026

/backport to stable33

@szaimen
Copy link
Copy Markdown
Contributor

szaimen commented Mar 25, 2026

/backport to stable32

@szaimen
Copy link
Copy Markdown
Contributor

szaimen commented Mar 25, 2026

/compile rebase

@szaimen
Copy link
Copy Markdown
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!

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

@rodrigocorreiaist
Copy link
Copy Markdown
Author

Hi @szaimen! I've added before and after screenshots to the PR description. I've also compiled the assets and pushed them to the branch (dist/core-public-page-menu.js and related files). Thank you for the review!
after
before

@joshtrichards
Copy link
Copy Markdown
Member

/compile /

@joshtrichards joshtrichards changed the title Fix #57282: icon color mismatch on download button in public share fix(sharing): icon color mismatch on download button in public share Apr 24, 2026
@szaimen szaimen removed their request for review April 27, 2026 15:44
… 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 force-pushed the fix/57282-download-button-icon-color branch from fc26cf7 to 29b040a Compare April 27, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Public share download button icon color

3 participants