Search results

Change the default search highlight color in JavaScript DocumentEditor control

30 Sep 2022 / 1 minute to read

Document editor provides an options to change the default search highlight color using searchHighlightColor in Document editor settings. The highlight color which is given in documentEditorSettings will be highlighted on the searched text. By default, search highlight color is yellow.

Similarly, you can use documentEditorSettings property for DocumentEditor also.

The following example code illustrates how to change the default search highlight color.

Copied to clipboard
let container: DocumentEditorContainer = new DocumentEditorContainer({ enableToolbar: true,height: '590px',
// Add required search highlight color
  documentEditorSettings: {
    searchHighlightColor: 'Grey',
  }
});
DocumentEditorContainer.Inject(Toolbar);
container.serviceUrl = 'https://ej2services.syncfusion.com/production/web-services/api/documenteditor/';
container.appendTo('#container');

Output will be like below:

How to change the default search highlight color