Skip to content

Allow to set viewerCssTheme which allows setting dark, light or automatic mode. #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
prabirshrestha opened this issue Oct 25, 2023 · 8 comments · Fixed by #21
Closed
Assignees

Comments

@prabirshrestha
Copy link

ref: mozilla/pdf.js#12625

const ViewerCssTheme = {
  AUTOMATIC: 0, // Default value.
  LIGHT: 1,
  DARK: 2,
};

Even better if we can pass options to the component or give us callback which allows to set the options.

@alekswebnet
Copy link
Owner

@prabirshrestha Implemented and will be available in the next release

@alekswebnet
Copy link
Owner

@prabirshrestha Since v2.5.0 you can use viewer-css-theme attribute to change viewer theme - AUTOMATIC | LIGHT | DARK

@prabirshrestha
Copy link
Author

Don't think v2.5.0 is correctly released. Tried both with pnpm and npm and also verified in yarnkpkg site.

https://yarnpkg.com/package?q=pdfjs-viewer-element&name=pdfjs-viewer-element&version=2.5.0&file=%2Fdist%2Fpdfjs-viewer-element.js

  static get observedAttributes() {
    return ["src", "viewer-path", "locale", "page", "search", "phrase", "zoom", "pagemode", "text-layer"];
  }

I don't see the latest change.

['src', 'viewer-path', 'locale', 'page', 'search', 'phrase', 'zoom', 'pagemode', 'text-layer', 'viewer-css-theme', 'viewer-extra-styles']

@alekswebnet
Copy link
Owner

@prabirshrestha You are right, it was my mistake. Sorry for that
The latest changes are available in the latest version: https://yarnpkg.com/package?q=pdfjs-viewer-element&name=pdfjs-viewer-element&version=2.5.2&file=%2Fdist%2Fpdfjs-viewer-element.js

@prabirshrestha
Copy link
Author

It works now. Would be good to have this site updated too. https://alekswebnet.github.io/pdfjs-viewer-element/#api

@alekswebnet
Copy link
Owner

@prabirshrestha You are right, I will update it soon

@alekswebnet
Copy link
Owner

@prabirshrestha The website is updated. Thanks for sharing!

@prabirshrestha
Copy link
Author

Thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants