Enter-tainer / typst-preview

[DEPRECATED] Use tinymist instead
https://Enter-tainer.github.io/typst-preview/
MIT License
444 stars 21 forks source link

feat: get dark theme for free by the `invert-colors` option #230

Closed Myriad-Dreamin closed 10 months ago

Myriad-Dreamin commented 10 months ago

Provides an option:

"typst-preview.invertColors": {
  "description": "Invert colors of the preview (useful for dark themes without cost). Please note you could see the origin colors when you hover elements in the preview.",
  "type": "string",
  "enum": [
    "never",
    "auto",
    "always"
  ],
  "default": "never",
  "enumDescriptions": [
    "Disable color inversion of the preview",
    "Invert colors smartly by detecting dark/light themes in browser environment or by `typst query` your document",
    "Always invert colors of the preview"
  ]
}

It inverts all color of items, but when you hover on images, they are back to origin color to help read content inside.

image

The `typst query` your document in auto is not implemented but I want to leave it in the initial feature PR, to remind users you can wait for a feature to disable it for specific templates (documents).