How do I change the highlight color for search results in the PrizmDoc Viewer?

Question

When doing a text search in a document in PrizmDoc, the highlight color for the search results is a light blue background. Is there a way to change the highlight color for search results in the PrizmDoc Viewer?

Answer

You can change the highlight color specifically in the PrizmDoc Viewer file viewer.js file located in the viewer-assets\js folder of your project/application.

You will need to locate 2 instances of the search term “highlightColor: undefined” in the code block below located close to line 4400. The actual line number will vary depending on the version of viewer.js you are using. You can replace “undefined” with a hexadecimal color value which you can look up from the following site: https://htmlcolorcodes.com/

// This is a request for a new searchQuery triggered by the search input field.
// Generate new search terms, and save them globally.
prevMatchingOptions = _.clone(matchingOptions);

if (matchingOptions.exactPhrase) {
    // We need to match the exact string, as is
    if (queryString.length) {
        searchTerms.push({
            searchTerm: queryString,
            highlightColor: undefined,
            searchTermIsRegex: false,
            contextPadding: 25,
            matchingOptions: matchingOptions
        });
    }
} else {
    // Split up multiple words in the string into separate search term objects
    var queryArr = queryString.split(' ');
    queryArr = _.unique(queryArr);
    _.forEach(queryArr, function(query){
        if (query.length) {
            searchTerms.push({
                searchTerm: query,
                highlightColor: undefined,
                searchTermIsRegex: false,
                contextPadding: 25,
                matchingOptions: matchingOptions
            });
        }
    });
}