Ritext
Extensions

Background Color

Apply a background highlight color to selected text.

The BackgroundColor extension adds a color picker dropdown for applying background highlight colors to selected text.

Import

import { BackgroundColor } from 'ritext/extension/backgroundcolor';

Requirements

Requires TextStyle from base extensions.

import { TextStyle } from 'ritext/extension/base';

const extensions = [TextStyle, BackgroundColor];

Usage

const extensions = [TextStyle, BackgroundColor];

Features

  • Preset color palette
  • Recent colors panel (up to 10, stored in localStorage)
  • Custom color picker via hex input

Custom Color List

BackgroundColor.configure({
  colorLists: ['#ffff00', '#ff9900', '#ff0000', '#00ff00', '#0000ff'],
})

Options

Prop

Type

On this page