Skip to content
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

No colors for default light theme #23

Open
eriknyk opened this issue Nov 1, 2023 · 1 comment
Open

No colors for default light theme #23

eriknyk opened this issue Nov 1, 2023 · 1 comment

Comments

@eriknyk
Copy link

eriknyk commented Nov 1, 2023

I'm using exacly code:

<script lang="ts">
  import { xml } from "@codemirror/lang-xml";
  import CodeMirror from "svelte-codemirror-editor";
  import xmlFormat from "xml-formatter";

  export let contents: string = "<xml>.....</xml>";
</script>

<CodeMirror
  value={contents ? xmlFormat(contents) : ""}
  lang={xml()}
  styles={{
    "&": {
      width: "100%",
      maxWidth: "100%",
      height: "100%",
    },
  }}
/>

And displays xml code without colors as following:

image

But if I use exactly same code with including dark theme as following:

<script lang="ts">
  import { xml } from "@codemirror/lang-xml";
  import CodeMirror from "svelte-codemirror-editor";
  import xmlFormat from "xml-formatter";
  import { oneDark } from "@codemirror/theme-one-dark";

  export let contents: string = "<xml>.....</xml>";
</script>

<CodeMirror
  value={contents ? xmlFormat(contents) : ""}
  lang={xml()}
  theme={oneDark}
  styles={{
    "&": {
      width: "100%",
      maxWidth: "100%",
      height: "100%",
    },
  }}
/>

xml is correctly hightlighed
image


I'm using versions:

"@codemirror/lang-xml": "^6.0.0",
"@codemirror/theme-one-dark": "^6.1.2",
"svelte-codemirror-editor": "^1.1.0",

Any feedback will be appreciated!
Regards.

@SomaticIT
Copy link
Contributor

Hello,

Thank you for your feedback.
Indeed, that's unexpected!

My first thought is that when you specify styles, you have to specify a theme since we do not specify one by default.
However, if I remember correctly, I use the lib like you in most of my projects, I will take a look a come back.

Thanks,
Maxime

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

No branches or pull requests

2 participants