6.1.1 • Published 1 month ago

@replit/codemirror-css-color-picker v6.1.1

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

CodeMirror Color Picker

A CodeMirror extension that adds a color picker input next to CSS color values.

preview

Usage

import { basicSetup } from 'codemirror';
import { EditorState } from '@codemirror/state';
import { EditorView } from '@codemirror/view';
import { css } from '@codemirror/lang-css';
import { colorPicker } from '@replit/codemirror-css-color-picker';

new EditorView({
  parent: document.querySelector('#editor'),
  state: EditorState.create({
    doc: '.wow {\n  color: #fff;\n}',
    extensions: [
      basicSetup,
      css(),
      colorPicker({
        style: {
          wrapper: {
            outlineColor: 'transparent',
          },
        },
      }),
    ],
  }),
});
interface CSSColorPickerOptions {
  /**
   * Additional [`style-mod`](https://github.com/marijnh/style-mod#documentation)
   * style spec providing theme for the color picker.
   */
  style?: {
    /** Style spec for the color picker `<div>` container */
    wrapper?: StyleSpec;
    /** Style spec for the color picker `<input>` element */
    input?: StyleSpec;
  };
}

Todos

  • Investigate solutions for alpha values. input[type="color"] doesn't support alpha values, we could show another number input next to it for the alpha value.
6.1.1

1 month ago

6.1.0

8 months ago

6.0.0

2 years ago

0.20.0

2 years ago

0.19.5

2 years ago

0.19.6

2 years ago

0.19.7

2 years ago

0.19.4

3 years ago

0.19.2

3 years ago

0.19.3

3 years ago

0.19.1

3 years ago

0.19.0

3 years ago