Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uiw/codemirror-extensions-color

Package Overview
Dependencies
Maintainers
0
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uiw/codemirror-extensions-color

Color Extensions for CodeMirror6.

  • 4.23.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.6K
decreased by-6.68%
Maintainers
0
Weekly downloads
 
Created
Source

Color Extensions

Buy me a coffee npm version

Color Extensions for CodeMirror6.

Codemirror Extensions Color

Install

npm install @uiw/codemirror-extensions-color --save

Usage

import CodeMirror from '@uiw/react-codemirror';
import { color, colorView, colorTheme } from '@uiw/codemirror-extensions-color';

function App() {
  return (
    <CodeMirror
      value="body { color: #333; }"
      extensions={[color]}
      // ------ Or ------
      // extensions={[colorView(false), colorTheme]}
      height="200px"
    />
  );
}
export default App;
import { EditorView } from '@codemirror/view';
import { EditorState } from '@codemirror/state';
import { color } from '@uiw/codemirror-extensions-color';

const state = EditorState.create({
  doc: 'body { color: #333; }',
  extensions: [color],
});

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

API

import { ViewPlugin, EditorView, ViewUpdate, DecorationSet } from '@codemirror/view';
import { Extension } from '@codemirror/state';
export declare enum ColorType {
  rgb = 'RGB',
  hex = 'HEX',
  named = 'NAMED',
  hsl = 'HSL',
}
export interface ColorState {
  from: number;
  to: number;
  alpha: string;
  colorType: ColorType;
}
export declare const colorView: (showPicker?: boolean) => ViewPlugin<{
  decorations: DecorationSet;
  update(update: ViewUpdate): void;
  changePicker(view: EditorView, canBeEdited: boolean): void;
}>;
export declare const colorTheme: Extension;
export declare const color: Extension;

Contributors

As always, thanks to our amazing contributors!

Made with action-contributors.

License

Licensed under the MIT License.

Keywords

FAQs

Package last updated on 25 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc