Skip to content

Theme is got from the browser settings rather than from Nextcloud settings #1141

@danxuliu

Description

@danxuliu

In theory it should be possible to set a specific theme with PDFViewerApplicationOptions.set('viewerCssTheme', {THEME_ID}), so the theme could be forced based on the Nextcloud theme, but unfortunately that option does not seem to work in the current PDF.js version used in the PDF viewer, 3.11.174. Moreover, that option was removed in the following PDF.js version, 4.0.189.

But! it was restored again in PDF.js 4.0.269, and in that version it works as expected when used from the PDF viewer.

Due to that this issue will be fixable once PDF.js is updated to 4.0.269 or later.

Note, however, that forcing a specific theme is done during the initialization of PDF.js and it does not seem to be possible to update the theme afterwards. Due to that, if the theme in Nextcloud is set to follow the browser theme, and the browser theme is changed while the PDF viewer is opened, even if the option is set again the theme will not be updated in the PDF viewer.

How to test

  • Open browser settings and set the light theme
  • Log in Nextcloud
  • Open Nextcloud "Appearance and accessibility" settings and set the dark theme
  • Open the Files app
  • Upload a PDF file
  • Open the PDF file

Expected result

The PDF viewer is shown with a dark theme, just like the Files app

Actual result

The PDF viewer is shown with a light theme, even if the Files app is shown with a dark theme

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions