Fix #57282: icon color mismatch on download button in public share#59175
Open
rodrigocorreiaist wants to merge 1 commit intonextcloud:masterfrom
Open
Fix #57282: icon color mismatch on download button in public share#59175rodrigocorreiaist wants to merge 1 commit intonextcloud:masterfrom
rodrigocorreiaist wants to merge 1 commit intonextcloud:masterfrom
Conversation
… 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 filtervar(--primary-invert-if-bright)was applied to it, but this variable inverts the icon in the wrong direction:--primary-invert-if-bright=no→ icon stays black, but text is white → mismatch ❌--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.cssswaps the icon CSS variables so that--icon-download-darkresolves to the white SVG. This means the filter logic must be reversed:--primary-invert-if-brightcorrectly inverts the white icon to black when the primary color is bright (matching the black text).Both the
prefers-color-scheme: darkmedia query and the Nextclouddata-themesattribute (used for explicit theme selection in Settings) are handled.