Skip to content

Add $search-highlight-bg SCSS variable for search result highlight color #14148

Open

Description

@cderv

Search result highlighting on destination pages (the ?q= parameter feature) uses bare <mark> elements, which inherit Bootstrap's default styling via $mark-bg / --bs-highlight-bg (yellow-100).

Users can already customize this through Bootstrap:

/*-- scss:defaults --*/
$mark-bg: #d1ecf1;

or via CSS:

:root {
  --bs-highlight-bg: #d1ecf1;
}

However, $mark-bg affects all <mark> elements on the page, not just search highlights. It would be useful to have a Quarto-specific SCSS variable like $search-highlight-bg that targets only search result marks, and is documented alongside other SCSS variables at https://quarto.org/docs/output-formats/html-themes.html#sass-variables.

This could be implemented by adding a CSS class to the <mark> elements created in quarto-search.js (line 1138):

const markEl = txt => {
  const el = document.createElement("mark");
  el.appendChild(document.createTextNode(txt));
  return el
}

and styling that class with a dedicated SCSS variable that falls back to $mark-bg.

Context: quarto-dev/quarto-web#1927 (review discussion)

Activity

  1. added
    themes
    on Mar 3, 2026
  2. added this to the v1.10 milestone on Mar 3, 2026
  3. modified the milestones: v1.10, v1.11 on Jul 30, 2026
  4. modified the milestones: v1.11, v1.12 on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    searchthemes

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions