Skip to content

Highlight verses using tag folder color. Solves #968#1336

Open
LAfricain wants to merge 1 commit into
crosswire:masterfrom
LAfricain:verse-highlight
Open

Highlight verses using tag folder color. Solves #968#1336
LAfricain wants to merge 1 commit into
crosswire:masterfrom
LAfricain:verse-highlight

Conversation

@LAfricain

Copy link
Copy Markdown
Contributor

feat: highlight verses using tag folder color

This PR adds visual highlighting of Bible verses based on their bookmark tag color.

New behavior

When a verse is bookmarked inside a colored tag folder, it is highlighted in the Bible text using that folder's color. The text color is automatically adjusted (white or black) based on the background luminance to ensure readability.

  • The current verse green highlight is disabled when a tag color is present, avoiding visual conflicts.
  • Verse ranges, comma-separated verses and semicolon-separated references are all supported.

Opting out

This feature is entirely driven by the tag color. If you do not want a tag folder to highlight its verses in the Bible text, simply remove its color (click "No color" when editing the folder). Folders without a color will not highlight any verses.

Details

  • Highlighting is handled in display.cc via get_tag_color_for_versekey()
  • Text color contrast is computed using the ITU-R BT.709 relative luminance formula
  • Depends on the bookmark color feature introduced in PR Bookmark color solves #685 #1317

@karlkleinpaste

Copy link
Copy Markdown
Contributor

First observation: It seems to work properly. That may seem like a trivial thing to say, but compared to the previous version a couple months ago, I'm pleased to be able to make the observation.

I have a couple further thoughts. No surprise there, I suppose.

  1. I like the fact that, when user annotation highlight is enabled, it still shows a bookmark folder color 1-space block next to the verse, although the annotation highlight controls. Kudos for that. Turning off annotation highlight makes the whole verse highlight according to folder color.
Screenshot at 2026-07-03 17-33-23
  1. However, the luminance test seems to be off. This verse is in a folder colored black (deliberately), and the resulting display is unreadable, when annotation highlight is turned off. I don't know if there's a way to improve this test, but I think you'd agree that "dark green text on black background" is far from a preferred colorization choice. It's probably significant, of course, that the verse is the current verse, which is why it's getting green in the first place. Perhaps being the current verse needs a special case consideration for luminance adjustment? I'm really not sure what to say about it other than that. I would appreciate your thoughts on it.
Screenshot at 2026-07-03 17-33-42
  1. I have an extensive set of bookmarks, after having been using Xiphos for 20 years; bookmarks.xml is ~250 lines long. So I've gone to the trouble to colorize my many folders, and unavoidably I've found myself re-using colors or using similar colors because, well, there are just so many colors out there. I have 2 folders that are somewhat different shades of blue, and another that's bright green. The result is a somewhat complicated-looking Gen 2.

Here's the thing: I can see that they're bookmarked because they're colored, but I have no reference for which bookmark in which folder.
Screenshot at 2026-07-03 17-34-00
Would there be a way to provide something like a mouse-hover (non-click) display in the status bar to show transiently (say) the bookmark name, or even folder+name? Not the whole folder-in-folder path -- my folders go 4 deep -- just the single containing folder. That would give me the clue to know where to go looking to find a bookmark I set 15 years ago and have long forgotten.

  1. A final thing, but I must say it's important. I realize that colorization is explicitly driven by folders having color, and getting rid of color is a controlled by a folder being set for No Color. But there are times I want to share my screen with an audience (e.g. teaching Bible study) when I don't want everyone else in the room to have their eyes drawn to my particular colorizations. I think what's needed is an enhancement to turn on/off the entire bookmark colorization system, in Preferences -> General -> Options. Default on, because the colorized display is valuable, but able to be turned off so that no bookmark colorization happens at all. Then when I go to teach, I could just disable the whole thing, and others seeing my screen don't find their eyes scrambled by my unusual color choices.

The Options part of Prefs has gotten kinda long and dense, so I suspect part of this latter need is that the default (or should I say minimum) size of Prefs should grow by a dozen pixels, or maybe two.

If you like, I could merge this as it stands -- it's good and functional and valuable -- with the proviso to do some more for it.

@karlkleinpaste

Copy link
Copy Markdown
Contributor

Oh, no...
Well, I can't merge this as-is after all, because of a major problem in rendering. I should have looked for more examples before running into this.

image

The luminance test (I suppose) has failed drastically. The missing text is actually present, it's just invisible, as indicated when I mouse-sweep the entire chapter.

Screenshot at 2026-07-04 08-23-58

The text is present, but is white-on-white.

Also, this again shows that current verse highlight leads to unreadable text, as v.1 is dark green on medium blue. Current verse color highlighting may need to be avoided entirely when a bookmark folder color is selected. And this shows why a means for disabling the entire bookmark colorization facility needs to be available on demand.

@karlkleinpaste

Copy link
Copy Markdown
Contributor

This further exposes another problem:

  • Only NET fails display this chapter correctly.
  • Some bookmark color choices are not uniform across versions.

This image is ESV.

Screenshot at 2026-07-04 08-30-51
  • There is no white-on-white text.
  • There is only one bookmark-colored verse.

Indeed, only NET shows the errors.

My NET (not the standard module) is ThML, not OSIS, but by the time Xiphos is providing renderable text, it's all just XHTML, so the source origin shouldn't be what's affecting this.

@karlkleinpaste

Copy link
Copy Markdown
Contributor

I'm afraid this is getting worse.

I have just 2 bookmarks that include Rev 22.

grep Rev.*22 ~/.config/xiphos/bookmarks/bookmarks.xml
      <Bookmark modulename="" key="Deu.28.27; 1Sam.17.39; Isa.14.23; Rom.5.7; Rom.13.13; 2Tim.2.25; Matt.1.1; Psalm.12.7; Prov.18.24; Matt.5.47;17.20; 1Cor.13.8; Gal.5.12;6.4; Eph.2.1; Rev.22.19" moduledescription=" " description="KJV flaws"/>
      <Bookmark modulename="" key="Deut 4:2;12:32; Rev 22:18,19" moduledescription=" " description="Add to/take away"/>

But all versions are showing colorization as if I had a half dozen such bookmarks.

ESV.
Screenshot at 2026-07-04 09-03-48

BSB.
Screenshot at 2026-07-04 08-49-49

@LAfricain

Copy link
Copy Markdown
Contributor Author

I'll take a look at it next week, but I can already say that, strangely enough, I'm not getting the same errors as you—in Revelation, everything is displaying correctly.
Don't you have any other blue bookmarks?

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.

2 participants