@uiw/codemirror-theme-solarized
TypeScript icon, indicating that this package has built-in type declarations

4.23.6 • Public • Published

Solarized Theme

Buy me a coffee npm version

This package implements the Solarized theme for the CodeMirror code editor.

codemirror-theme-solarized codemirror-theme-solarized

Install

npm install @uiw/codemirror-theme-solarized --save
import { EditorState } from '@codemirror/state';
import { javascript } from '@codemirror/lang-javascript';
import { solarizedLight, solarizedDark } from '@uiw/codemirror-theme-solarized';

const state = EditorState.create({
  doc: 'my source code',
  extensions: [solarizedLight, javascript({ jsx: true })],
});

Using in React:

import { solarizedLight, solarizedLightInit, solarizedDark, solarizedDarkInit } from '@uiw/codemirror-theme-solarized';
// Or
import { solarizedDark, solarizedDarkInit } from '@uiw/codemirror-theme-solarized/dark';
import { solarizedLight, solarizedLightInit } from '@uiw/codemirror-theme-solarized/light';

<CodeMirror theme={solarizedLight} />
<CodeMirror
  theme={solarizedLightInit({
    settings: {
      caret: '#c6c6c6',
      fontFamily: 'monospace',
    }
  })}
/>

API

import { CreateThemeOptions } from '@uiw/codemirror-themes';
export declare const defaultSettingsSolarizedLight: CreateThemeOptions['settings'];
export declare const solarizedLightInit: (
  options?: Partial<CreateThemeOptions>,
) => import('@codemirror/state').Extension;
export declare const solarizedLight: import('@codemirror/state').Extension;
export declare const defaultSettingsSolarizedDark: CreateThemeOptions['settings'];
export declare const solarizedDarkInit: (
  options?: Partial<CreateThemeOptions>,
) => import('@codemirror/state').Extension;
export declare const solarizedDark: import('@codemirror/state').Extension;

Usage

import CodeMirror from '@uiw/react-codemirror';
import { solarizedLight, solarizedDark } from '@uiw/codemirror-theme-solarized';
import { javascript } from '@codemirror/lang-javascript';

function App() {
  return (
    <CodeMirror
      value="console.log('hello world!');"
      height="200px"
      theme={solarizedLight}
      extensions={[javascript({ jsx: true })]}
    />
  );
}
export default App;
import { EditorView } from '@codemirror/view';
import { EditorState } from '@codemirror/state';
import { javascript } from '@codemirror/lang-javascript';
import { solarizedLight, solarizedDark } from '@uiw/codemirror-theme-solarized';

const state = EditorState.create({
  doc: 'my source code',
  extensions: [solarizedLight, javascript({ jsx: true })],
});

const view = new EditorView({
  parent: document.querySelector('#editor'),
  state,
});

Contributors

As always, thanks to our amazing contributors!

Made with github-action-contributors.

License

Licensed under the MIT License.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
4.23.6
4,447latest

Version History

VersionDownloads (Last 7 Days)Published
4.23.6
4,447
4.23.5
243
4.23.4
1
4.23.3
140
4.23.2
162
4.23.1
0
4.23.0
368
4.22.2
27
4.22.1
128
4.22.0
530
4.21.25
595
4.21.24
1,415
4.21.23
0
4.21.22
63
4.21.21
59
4.21.20
30
4.21.19
1
4.21.18
1
4.21.176
4.21.160
4.21.150
4.21.140
4.21.130
4.21.121
4.21.115
4.21.100
4.21.9694
4.21.81
4.21.7645
4.21.60
4.21.50
4.21.43
4.21.3356
4.21.29
4.21.10
4.21.00
4.20.40
4.20.30
4.20.20
4.20.10
4.20.00
4.19.16820
4.19.156
4.19.140
4.19.130
4.19.120
4.19.110
4.19.100
4.19.94
4.19.82
4.19.71
4.19.60
4.19.58
4.19.40
4.19.30
4.19.20
4.19.10
4.19.00
4.18.20
4.18.10
4.18.00
4.17.10
4.17.01
4.16.00

Package Sidebar

Install

npm i @uiw/codemirror-theme-solarized

Weekly Downloads

8,567

Version

4.23.6

License

MIT

Unpacked Size

31.9 kB

Total Files

29

Last publish

Collaborators

  • uiwjs
  • wcjiang