Fix dark/light icon variant for External links in the Settings menu#1130
Open
cookie-monster1649 wants to merge 1 commit into
Open
Fix dark/light icon variant for External links in the Settings menu#1130cookie-monster1649 wants to merge 1 commit into
cookie-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>
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.
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