James-Yu / LaTeX-Workshop

Boost LaTeX typesetting efficiency with preview, compile, autocomplete, colorize, and more.
MIT License
10.62k stars 529 forks source link

The pdf viewer can't display colors and has bad quality overall #4272

Closed GiovanniKarra closed 4 months ago

GiovanniKarra commented 4 months ago

Please fill the following fields with a star (*) and provide as much related information as possible.

Pre-checks*

Please change the following [ ] to [x] for confirmation.

  • [x] The issue has not been reported in this repository.
  • [X] The issue remains after disabling all other extensions and restarting Visual Studio Code.
  • [X] The FAQ cannot address the issue.
  • [X] The issue is not related to compiling a document, or the document can be successfully compiled in the OS terminal but not in Visual Studio Code with this extension.

Environment*

Please write exact version numbers instead of descriptors such as latest.

  • Operating System: Linux Mint 21.3
  • Visual Studio Code Version: 1.89.1
  • LaTeX Workshop Version: 9.20.1
  • TeX Distribution Version: TeX Live 2021.20220204-1

Please list the environment and version number if you are using VSCodium, Snap or Flatpack versions of Visual Studio Code, and/or Visual Studio Code Remote Containers/SSH/WSL.

  • I am using VSCode from the deb repo

The Issue*

Please briefly describe the issue you come across.

  • The pdf viewer has a bad quality and is always grayscale (I haven't touched the settings)

Reproduction Steps

Please list out the steps to reproduce your bug. Include relevant environmental variables or any other configuration.

  1. open a pdf file with latex workshop enabled

Expected Behavior

What were you expecting to see? Include any relevant examples or documentation links.

  • a colored document

Logs

LaTeX Workshop Output*

Please paste the whole log messages below, not parts of ones. The log should start with New log placeholder %WS1% registered.


[14:24:03.348][Logger] New log placeholder %WS1% registered for /home/giogio/Documents/LinuxPresentation .
[14:24:03.348][Extension] Initializing LaTeX Workshop.
[14:24:03.562][Build][Recipe] Set $LATEXWORKSHOP_DOCKER_LATEX: ""
[14:24:03.629][Server] Creating LaTeX Workshop http and websocket server.
[14:24:03.744][Format][Bib] Bibtex format config: {"tab":"    ","case":"lowercase","left":"{","right":"}","trailingComma":false,"sort":["key"],"alignOnEqual":true,"sortFields":false,"fieldsOrder":[],"firstEntries":["string","xdata"]}
[14:24:03.809][Server] Server successfully started: {"address":"127.0.0.1","family":"IPv4","port":40969} .
[14:24:03.817][Extension] Extension root: /home/giogio/.vscode/extensions/james-yu.latex-workshop-9.20.1
[14:24:03.818][Extension] $PATH: /home/giogio/.cargo/bin:/home/giogio/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
[14:24:03.818][Extension] $SHELL: /bin/zsh
[14:24:03.818][Extension] $LANG: en_US.UTF-8
[14:24:03.819][Extension] $LC_ALL: undefined
[14:24:03.819][Extension] process.platform: linux
[14:24:03.819][Extension] process.arch: x64
[14:24:03.819][Extension] vscode.env.appName: Visual Studio Code
[14:24:03.820][Extension] vscode.env.remoteName: undefined
[14:24:03.820][Extension] vscode.env.uiKind: 1
[14:24:03.826][Config] latex-workshop.latex.external.build.args: ["--shell-escape"] .
[14:24:03.850][Config] latex-workshop.view.pdf.color.dark.pageColorsBackground: "#F8F8F8" .
[14:24:03.851][Config] latex-workshop.view.pdf.color.dark.backgroundColor: "#404040" .
[14:24:03.884][Config] latex-workshop.bibtex-format.tab: "4 spaces" .
[14:24:03.895][Extension] Trigger characters for intellisense of LaTeX documents: ["\\",",","{"]
[14:24:03.898][Root] Current workspace folders: ["file://%WS1%"]
[14:24:03.899][Extension] LaTeX Workshop initialized.
[14:24:03.904][Root] Current workspaceRootDir: file://%WS1% .
[14:24:03.922][Server] valdOrigin is http://127.0.0.1:40969
[14:24:04.160][Root] No root file found.
[14:24:04.161][Structure] Structure cleared on undefined root.
[14:24:04.161][Event] ROOT_FILE_SEARCHED
[14:24:04.161][Event] STRUCTURE_UPDATED
[14:24:06.097][Cacher] Error loading cache: %WS1%/main.tex . Forcing.
[14:24:06.102][Cacher] Caching %WS1%/main.tex .
[14:24:06.104][Cacher] Updated inputs of %WS1%/main.tex .
[14:24:06.104][Cacher] Parse LaTeX AST: %WS1%/main.tex .
[14:24:06.105][Cacher] Error loading cache: %WS1%/main.tex . Forcing.
[14:24:06.108][Cacher] Caching %WS1%/main.tex .
[14:24:06.109][Cacher] Updated inputs of %WS1%/main.tex .
[14:24:06.109][Cacher] Parse LaTeX AST: %WS1%/main.tex .
[14:24:06.110][Cacher] Error loading cache: %WS1%/main.tex . Forcing.
[14:24:06.111][Cacher] Caching %WS1%/main.tex .
[14:24:06.111][Cacher] Updated inputs of %WS1%/main.tex .
[14:24:06.112][Cacher] Parse LaTeX AST: %WS1%/main.tex .
[14:24:06.116][Cacher] Parsed LaTeX AST: %WS1%/main.tex .
[14:24:06.117][Cacher] Updated elements in 0.82 ms: %WS1%/main.tex .
[14:24:06.118][Event] FILE_PARSED: "%WS1%/main.tex"
[14:24:06.118][Structure][LaTeX] Error loading content during structuring: %WS1%/main.tex .
[14:24:06.118][Structure][LaTeX] Error loading content during structuring: %WS1%/main.tex .
[14:24:06.119][Cacher] Parsed LaTeX AST: %WS1%/main.tex .
[14:24:06.120][Cacher] Updated elements in 0.64 ms: %WS1%/main.tex .
[14:24:06.121][Event] FILE_PARSED: "%WS1%/main.tex"
[14:24:06.121][Structure][LaTeX] Error loading content during structuring: %WS1%/main.tex .
[14:24:06.122][Cacher] Parsed LaTeX AST: %WS1%/main.tex .
[14:24:06.123][Cacher] Updated elements in 0.40 ms: %WS1%/main.tex .
[14:24:06.123][Event] FILE_PARSED: "%WS1%/main.tex"
[14:24:06.124][Structure] Structure cleared on undefined root.
[14:24:06.124][Event] STRUCTURE_UPDATED
[14:24:06.124][Structure][LaTeX] Error loading content during structuring: %WS1%/main.tex .
[14:28:24.184][Structure] Structure cleared on undefined root.
[14:28:24.185][Event] STRUCTURE_UPDATED
[14:28:24.489][Structure][LaTeX] Error loading content during structuring: %WS1%/main.tex .
[14:32:41.209][Viewer][Panel] Internal PDF viewer at http://127.0.0.1:40969/viewer.html?file=pdf..ZmlsZSUzQSUyRiUyRiUyRmhvbWUlMkZnaW9naW8lMkZEb2N1bWVudHMlMkZMaW51eFByZXNlbnRhdGlvbiUyRmZpZ3VyZXMucGRm .
[14:32:41.211][Cacher][Watcher] Watched %WS1%/figures.pdf with a new .pdf watcher on %WS1% .
[14:32:41.211][Event] FILE_WATCHED: "%WS1%/figures.pdf"
[14:32:41.564][Viewer] Handle data type: open
[14:32:41.739][Server] Preview PDF file: file://%WS1%/figures.pdf
[14:32:41.963][Viewer] Handle data type: loaded
[14:32:41.964][Event] VIEWER_PAGE_LOADED
[14:32:52.089][Viewer][Panel] Internal PDF viewer at http://127.0.0.1:40969/viewer.html?file=pdf..ZmlsZSUzQSUyRiUyRiUyRmhvbWUlMkZnaW9naW8lMkZEb2N1bWVudHMlMkZMaW51eFByZXNlbnRhdGlvbiUyRmZpZ3VyZXMucGRm .
[14:32:52.091][Cacher][Watcher] Watched %WS1%/figures.pdf by the .pdf watcher.
[14:32:52.092][Event] FILE_WATCHED: "%WS1%/figures.pdf"
[14:32:52.385][Viewer] Handle data type: open
[14:32:52.541][Server] Preview PDF file: file://%WS1%/figures.pdf
[14:32:52.883][Viewer] Handle data type: loaded
[14:32:52.884][Event] VIEWER_PAGE_LOADED
[14:38:23.135][Config] Configuration changed to { latex-workshop.view.pdf.invertMode.grayscale: 0 } at file://%WS1% .
[14:38:23.317][Viewer] Handle data type: open
[14:38:23.452][Server] Preview PDF file: file://%WS1%/figures.pdf
[14:38:24.352][Viewer] Handle data type: loaded
[14:38:24.352][Event] VIEWER_PAGE_LOADED
[14:38:27.332][Viewer][Panel] Internal PDF viewer at http://127.0.0.1:40969/viewer.html?file=pdf..ZmlsZSUzQSUyRiUyRiUyRmhvbWUlMkZnaW9naW8lMkZEb2N1bWVudHMlMkZMaW51eFByZXNlbnRhdGlvbiUyRmZpZ3VyZXMucGRm .
[14:38:27.334][Cacher][Watcher] Watched %WS1%/figures.pdf by the .pdf watcher.
[14:38:27.334][Event] FILE_WATCHED: "%WS1%/figures.pdf"
[14:38:27.617][Viewer] Handle data type: open
[14:38:27.788][Server] Preview PDF file: file://%WS1%/figures.pdf
[14:38:28.009][Viewer] Handle data type: loaded
[14:38:28.009][Event] VIEWER_PAGE_LOADED
[14:38:37.400][Config] Configuration changed to { latex-workshop.view.pdf.invertMode.grayscale: 0.6 } at file://%WS1% .
[14:38:37.511][Viewer] Handle data type: open
[14:38:37.664][Server] Preview PDF file: file://%WS1%/figures.pdf
[14:38:39.110][Viewer] Handle data type: loaded
[14:38:39.111][Event] VIEWER_PAGE_LOADED

### Developer Tools Console
> _Please paste the whole log messages below, not parts of ones. This console logs can sometimes be very important in many cases. To access the log, click `Help` -> `Toggle Developer Tools` -> `Console`._

INFO Started local extension host with pid 14365. 12log.ts:429 WARN [cmake-tools]: Couldn't find message for key cmake-tools.configuration.cmake.options.advanced.statusBarLength.description. log.ts:439 ERR Cannot read properties of undefined (reading 'accessToken'): TypeError: Cannot read properties of undefined (reading 'accessToken') at p.z (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:1686:21851) at p.C (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:1686:22484) at d.value (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:1686:21653) workspace.contribution.ts:330 AI generated workspace trust dialog contents not available. (anonymous) @ workspace.contribution.ts:330 console.ts:137 [Extension Host] [vscode-icons] v12.7.0 activated! 12log.ts:429 WARN [cmake-tools]: Couldn't find message for key cmake-tools.configuration.cmake.options.advanced.statusBarLength.description. log.ts:429 WARN [twxs.cmake]: Cannot register 'cmake.cmakePath'. This property is already registered. log.ts:439 ERR Ignoring latex-workshop.synctex.indicator.enabled as latex-workshop.synctex.indicator is "rectangle" log.ts:419 INFO [perf] Render performance baseline is 208ms 6An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing. TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.tex. Old grammar file: file:///usr/share/code/resources/app/extensions/latex/syntaxes/TeX.tmLanguage.json. New grammar file: file:///home/giogio/.vscode/extensions/james-yu.latex-workshop-9.20.1/syntax/TeX.tmLanguage.json register @ TMScopeRegistry.ts:46 TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.tex.latex. Old grammar file: file:///usr/share/code/resources/app/extensions/latex/syntaxes/LaTeX.tmLanguage.json. New grammar file: file:///home/giogio/.vscode/extensions/james-yu.latex-workshop-9.20.1/syntax/LaTeX.tmLanguage.json register @ TMScopeRegistry.ts:46 TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.bibtex. Old grammar file: file:///usr/share/code/resources/app/extensions/latex/syntaxes/Bibtex.tmLanguage.json. New grammar file: file:///home/giogio/.vscode/extensions/james-yu.latex-workshop-9.20.1/syntax/Bibtex.tmLanguage.json register @ TMScopeRegistry.ts:46 TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.tex.markdown_latex_combined. Old grammar file: file:///usr/share/code/resources/app/extensions/latex/syntaxes/markdown-latex-combined.tmLanguage.json. New grammar file: file:///home/giogio/.vscode/extensions/james-yu.latex-workshop-9.20.1/syntax/markdown-latex-combined.tmLanguage.json register @ TMScopeRegistry.ts:46 TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope source.cpp.embedded.latex. Old grammar file: file:///usr/share/code/resources/app/extensions/latex/syntaxes/cpp-grammar-bailout.tmLanguage.json. New grammar file: file:///home/giogio/.vscode/extensions/james-yu.latex-workshop-9.20.1/syntax/cpp-grammar-bailout.tmLanguage.json register @ TMScopeRegistry.ts:46 index.html?id=9f61853a-19c8-446f-9758-6efe2a8f0a36&origin=98810e35-49cc-491e-ac9c-97977d4e1de8&swVersion=4&extensionId=James-Yu.latex-workshop&platform=electron&vscode-resource-base-authority=vscode-resource.vscode-cdn.net&parentOrigin=vscode-file%3A%2F%2Fvscode-app&purpose=webviewView:278 No service worker controller found. Waiting for controllerchange.

James-Yu commented 4 months ago

Please share your pdf and screenshots.

GiovanniKarra commented 4 months ago

Comparison: image

file: presentation.pdf

15513640061 commented 4 months ago

I meet the same question both in VSCode viewer and web browser pdf viewer. Only in external pdf viewer (sumtrapdf) can display colors.

James-Yu commented 4 months ago

Don't set latex-workshop.view.pdf.color.dark.pageColorsBackground. This is a PDF.js behavior.