Skip to content

Fix/search highlights - #1

Open
mdeloughry wants to merge 2 commits into
tyronejosee:masterfrom
mdeloughry:fix/search-highlights
Open

Fix/search highlights#1
mdeloughry wants to merge 2 commits into
tyronejosee:masterfrom
mdeloughry:fix/search-highlights

Conversation

@mdeloughry

Copy link
Copy Markdown

Love the theme!
Just found the following issues.

Search highlights were invisible, when searching for words/phrases.

Changed the following:

  • Replace hardcoded --text-selection with accent ready hsla values in both dark and light themes
  • Add --text-highlight-bg variable for highlighted text and search
  • Add .cm-searchMatch styles for in-editor find
  • Add .cm-searchMatch-selected for the active match with stronger opacity
  • Add .search-result-file-matched-text for global search panel results

All highlights now use the accent colour HSL variables so they adapt to the chosen accent colour in Obsidian settings.

Search highlights were invisible due to two issues:

- --text-selection used a hardcoded blue rgba value that was nearly
  invisible on the pure black background
- No styles existed for CodeMirror search match classes or the global
  search result highlights

Changes:
- Replace hardcoded --text-selection with accent-aware hsla values
  in both dark and light themes
- Add --text-highlight-bg variable for ==highlighted text== and search
- Add .cm-searchMatch styles for in-editor find (Ctrl/Cmd+F)
- Add .cm-searchMatch-selected for the active match with stronger opacity
- Add .search-result-file-matched-text for global search panel results

All highlights now use the accent color HSL variables so they adapt
to the user's chosen accent color in Obsidian settings.
The previous fix used only CodeMirror class names which Obsidian
doesn't apply. Add the correct Obsidian selectors:

- .cm-s-obsidian span.obsidian-search-match-highlight for in-editor matches
- .search-result-container --text-highlight-bg override for global search
- !important on backgrounds to ensure visibility over competing styles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant