Uh oh!
There was an error while loading. Please reload this page.
Fix dark/light icon variant for External links in the Settings menu - #1130
Fix dark/light icon variant for External links in the Settings menu#1130cookie-monster1649 wants to merge 1 commit into
Conversation
External links with position `settings` used the base (light) icon in Nextcloud's account/Settings menus. Core recolours those entries with the `--background-invert-if-dark` filter, which expects a dark-coloured source: in the dark theme the light base icon was inverted to black and became invisible. For Settings-menu entries, prefer the paired `-dark` icon variant (e.g. `foo-dark.svg` for `foo.svg`) when such a file exists in app data, falling back to the configured icon otherwise. Header links, guest/login links, public footer links and quota icons are unchanged. The same selection is applied in both navigation registration paths (Application::registerSites and BeforeTemplateRenderedListener), since both register the same navigation entry; changing only one had no visible effect. Fixes: nextcloud#430 This change was AI-assisted and validated on Nextcloud 34.0.1. Signed-off-by: cookie-monster1649 <jj@monester.au> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Hello there, 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.) |
Problem
External links configured with position
settingsused the wrong iconvariant in Nextcloud's account and Settings menus.
For a paired icon such as
audiobookshelf.svg/audiobookshelf-dark.svg,the base filename
audiobookshelf.svgwas always registered. Nextcloud'sSettings menu then applies its own theme-dependent filter:
In the dark theme this inverts the source icon. Because the source was
already the light-coloured icon, it was inverted to black and became hard
or impossible to see against the dark menu background.
Root cause
External registers the same navigation entry in two places:
Application::registerSites()BeforeTemplateRenderedListener::generateNavigationLinks()Both supplied the configured base filename for Settings entries, so a fix
in only one file had no visible effect.
Change
For entries of type
SitesManager::TYPE_SETTING, the registration code now:external.svg).-darkbefore the extension.-dark.icon (avoidsfoo-dark-dark.svg).Header links, guest/login links, public footer links and quota icons are
unchanged. The same block is applied in both registration paths.
Why this works
-darkis the dark-coloured source asset. In the Settings menu the lighttheme shows it unchanged, and the dark theme applies core's existing
inversion to produce a light icon — matching core's rendering rather than
adding theme detection inside External.
Scope / non-goals
Does not change header, footer, quota, mobile/desktop client icon selection,
stored site config, or icon upload. Full-colour (non-monochrome) icons can
still be affected by core's inversion; this follows the app's existing paired
monochrome-icon convention and does not claim to solve arbitrary coloured icons.
Follow-ups (not in this PR, to keep it targeted)
Standards checked
php -l) passes on both changed filesTesting
/apps/external/icons/audiobookshelf-dark.svginstead ofaudiobookshelf.svg.-darkpair exists.php -land php-cs-fixer pass on both changed files.This change was AI-assisted and validated on Nextcloud 34.0.1.
Fixes#430