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

How to change the font #636

Open
acsses opened this issue Mar 2, 2024 · 5 comments
Open

How to change the font #636

acsses opened this issue Mar 2, 2024 · 5 comments

Comments

@acsses
Copy link

acsses commented Mar 2, 2024

How to change font to one included in google fonts?

@jaywcjlove
Copy link
Member

@acsses like this?

.cm-editor {
  font-family: 'Your Desired Font', sans-serif !important; 
}

@acsses
Copy link
Author

acsses commented Mar 3, 2024

I tried it, But it didn't work.

and I forget to write my env.
my env is blow

  • npm 10.5.0
  • next.js

@jaywcjlove
Copy link
Member

@acsses You can give it a try:

const FontFamilyTheme = EditorView.theme({
  $: {
    fontFamily: "'Your Desired Font', sans-serif !important"
  }
});

<CodeMirror extensions={[FontFamilyTheme]} />;

@jaywcjlove
Copy link
Member

const Theme = EditorView.theme({
  ".cm-content": {
    fontFamily: "Menlo, Monaco, Lucida Console, monospace"
  },
});

@acsses
Copy link
Author

acsses commented Mar 4, 2024

the later methods work! thank you!

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