Changing highlight color of selected text

825 views
Skip to first unread message

n.holz...@gmail.com

unread,
Sep 9, 2019, 3:40:40 PM9/9/19
to chromium-hterm
Hi, 

I'm running a terminal emulator using hterm on iOS. 
Everything is fine, except when I'm running in dark mode and I select text: the selected text barely appears on the black background. Looking closely, it seems there is a light gray rectangle that gets blended with the dark background. There is no problem in light mode because the light gray rectangle is visible against the white background.

I would like to change the color of the selected text. I've tried setting the "::selection" tag in various places, but there was no visible results. I'm probably not trying in the right place. 

Thanks a lot, 
N. Holzschuch

Mike Frysinger

unread,
Sep 9, 2019, 4:27:25 PM9/9/19
to n.holz...@gmail.com, chromium-hterm
currently the text selection is deferred to the browser/OS.  thus the highlighting colors you see are whatever the browser is deciding to do here.  we don't have any supported methods for changing that currently.

it does seem like CSS ::selection would be your best bet.  i tried putting this into my custom css text and it seemed to work, but i only tested Linux:
::selection {
  color: red;
  background-color: green;
}
-mike

--
You received this message because you are subscribed to the Google Groups "chromium-hterm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-hter...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-hterm/0d37de00-649e-4e06-b72b-cb1cdd0681fc%40chromium.org.

Theodore Dubois

unread,
Sep 9, 2019, 5:21:49 PM9/9/19
to Mike Frysinger, n.holz...@gmail.com, chromium-hterm
I've spent some time debugging this and found it's related to the focused element being contentEditable. Turning off the contentEditable makes the selection blue again, but then that doesn't work with IME.

The selection is also missing the handles in addition to being grey. This seems more likely to be a webkit bug than anything else.

~Theodore
> To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-hterm/CAAbOScn5RJP3nL2Mof2b4gN7j6E4xLX%3DjM9g3sUKKGt3oE6Zdw%40mail.gmail.com.

n.holz...@gmail.com

unread,
Sep 30, 2019, 4:02:56 PM9/30/19
to chromium-hterm
Hi, 

answering my own question for future references: on iOS 13 with WKWebView, the color of the selected text is... caret-color. 

By default, hterm defines "caret-color = transparent" (which makes sense, since we want the webview cursor to be invisible so the hterm cursor is clearly visible).

So, the solution for this specific configuration is to have "caret-color = var(--hterm-cursor-color);".

Nicolas
Reply all
Reply to author
Forward
0 new messages