0.1.2 • Published 1 year ago

codemirror-theme-vars v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

CoderMirror --theme-vars

A customizable CodeMirror theme using CSS variables

NPM version

Usage

npm i codemirror-theme-vars
import 'codemirror-theme-vars/base.css'
new CoderMirror({
  theme: 'vars'
})

or

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/codemirror-theme-vars/base.css">

Configuration

Add CSS variables in your CSS, For example:

@import "codemirror-theme-vars/base.css";

:root {
  --cm-foreground: #393a34;
  --cm-background: #fbfbfb;
  --cm-comment: #b8c4b8;
  --cm-string: #c67b5d;
  --cm-literal: #3a9c9b;
  --cm-keyword: #248459;
  --cm-function: #849145;
  --cm-deleted: #a14f55;
  --cm-class: #2b91af;
  --cm-builtin: #a52727;
  --cm-property: #ad502b;
  --cm-namespace: #c96880;
  --cm-punctuation: #8e8f8b;
  --cm-decorator: #bd8f8f;
  --cm-json-property: #698c96;
}

See base.css for more options avaliable.

Built-in Themes

We have a few themes variables built-in that you can directly use.

@import "codemirror-theme-vars/base.css";
@import "codemirror-theme-vars/themes/vitesse-light.css";

/* Overrides */
:root {
  --cm-background: #ffffff;
}

See all themes avaliable under themes/*. Contributions are also greatly welcome!

Work with prism-theme-vars

@import "codemirror-theme-vars/base.css";
@import "codemirror-theme-vars/to-prism.css";

/* --cm prefix will alias to --prism automatically */
:root {
  --cm-foreground: #393a34;
  --cm-background: #fbfbfb;
}

Dark mode

Here is an example of Tailwind CSS favored dark mode support.

html:not(.dark) {
  --cm-foreground: #393a34;
  --cm-background: #f8f8f8;

  --cm-comment: #758575;
  --cm-namespace: #444444;
  --cm-string: #bc8671;
  --cm-punctuation: #80817d;
  --cm-literal: #36acaa;
  --cm-keyword: #248459;
  --cm-function: #849145;
  --cm-deleted: #9a050f;
  --cm-class: #2b91af;
  --cm-builtin: #800000;
  --cm-property: #ce9178;
  --cm-regex: #ad502b;
}

html.dark {
  --cm-foreground: #d4d4d4;
  --cm-background: #1e1e1e;

  --cm-namespace: #aaaaaa;
  --cm-comment: #758575;
  --cm-namespace: #444444;
  --cm-string: #ce9178;
  --cm-punctuation: #d4d4d4;
  --cm-literal: #36acaa;
  --cm-keyword: #38a776;
  --cm-function: #dcdcaa;
  --cm-deleted: #9a050f;
  --cm-class: #4ec9b0;
  --cm-builtin: #d16969;
  --cm-property: #ce9178;
  --cm-regex: #ad502b;
}

License

MIT

slidev-theme-cabbageslidev-theme-cucslidev@everything-registry/sub-chunk-1350@kolibrijs/theme-apple-basic@kolibrijs/theme-bricks@kolibrijs/theme-default@kolibrijs/theme-seriph@kolibrijs/theme-shibainu@kolibry/theme-apple-basic@kolibry/theme-bricks@kolibry/theme-default@kolibry/theme-seriph@kolibry/theme-shibainu@openscript-ch/slidev-theme@openscript-ch/slidev-theme-i18natomico-editor@zlict/slidev-theme-zlislidev-theme-slidev-modern-tech@mudssky/slidev-theme-default@posva/slidev-theme@slidev/theme-bricks@slidev/theme-default@slidev/theme-seriph@slidev/theme-shibainu@slidex/theme-default@slidev/theme-apple-basic@slidex/theme-seriph@yettoapp/slidev-theme-yetto@webksde/slidev-theme-webksde@windicss/vitepress-themeslidev-theme-betaslidev-theme-bitnateslidev-theme-boltslidev-theme-bscslidev-theme-capgeminislidev-theme-codegslidev-theme-cucslidev-theme-dashengslidev-theme-datev-sccslidev-theme-demateslidev-theme-denkwerkslidev-theme-diapositivslidev-theme-dimsamslidev-theme-divriotsslidev-theme-doctolibslidev-theme-dotnet-junkieslidev-theme-draculaslidev-theme-dyteslidev-theme-dyte-vaibhavshnslidev-theme-easyslidev-theme-eaviseslidev-theme-eclipseslidev-theme-ehl2022slidev-theme-oxslidev-theme-papershareslidev-theme-patrickdronkslidev-theme-penguin--kevin-fabreslidev-theme-penguin-htslidev-theme-platformaticslidev-theme-poli-uspslidev-theme-pptslidev-theme-project-documentationslidev-theme-prussianblueslidev-theme-queenslabslidev-theme-rainforestslidev-theme-renuoslidev-theme-rohslidev-theme-secsislidev-theme-shadowslidev-theme-shopeeslidev-theme-showyslidev-theme-sobaslidev-theme-spezislidev-theme-sprinteinsslidev-theme-stordahlslidev-theme-excelseaslidev-theme-fhaachenslidev-theme-flyingstudioslidev-theme-frankfurtslidev-theme-friendlyslidev-theme-geistslidev-theme-genericslidev-theme-greycatslidev-theme-happyslidev-theme-hepslidev-theme-hexletslidev-theme-hexoslidev-theme-hydra-confslidev-theme-i18nslidev-theme-imatechslidev-theme-iodigitalslidev-theme-kageslidev-theme-kolaente-basicslidev-theme-ksick-dynatraceslidev-theme-lamdaslidev-theme-lecture-slidesslidev-theme-meetupslidev-theme-modern-techslidev-theme-monoslidev-theme-movistar
0.1.2

1 year ago

0.1.1

3 years ago

0.1.0

3 years ago