scambier / obsidian-omnisearch

A search engine that "just works" for Obsidian. Supports OCR and PDF indexing.
GNU General Public License v3.0
1.26k stars 65 forks source link

[BUG] omnisearch-highlight CSS highlight update not effective #366

Closed dkzsys closed 7 months ago

dkzsys commented 7 months ago

Problem description:

I am trying to update the omnisearch result highlight with yellow background; unfortunately, I'm unable to achieve that using CSS styling for omnisearch-highlight.

Your environment:

Things I tried:

I have tried the following 2 CSS Styling. Unfortunately, no change to the highlight.

.omnisearch-highlight {
  color: var(--text-normal);
  background-color: var(--text-highlight-bg);
}
.omnisearch-highlight {
  color: white;
  background-color: yellow;
}

Sample search result image

dkzsys commented 7 months ago

I've tried updating the CSS styling for .omnisearch-result__title and it works.

.omnisearch-result__title { color: var(--text-normal); background-color: var(--text-highlight-bg); }

image

scambier commented 7 months ago

I just tried with

.omnisearch-highlight {
  color: white;
  background-color: yellow;
}

and it works as expected. Maybe try to add !important?

.omnisearch-highlight {
  color: white !important;
  background-color: yellow !important;
}
dkzsys commented 7 months ago

Still don't have much luck with !important.

.omnisearch-result__title works, indicating the CSS Style file is recognised; I don't see any other css style that may have overridden it. Any other thoughts pls?

image

scambier commented 7 months ago

Is this 2nd screenshot the CSS snippet you're using? That's a markdown file, not a valid CSS file.

image

dkzsys commented 7 months ago

Oops... such a silly mistake. Thank you for spotting that. Working perfectly fine as you mentioned @scambier. Appreciate your help! image