AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Chrome selected text color9/19/2023 ![]() Any ideas Its not like that on my desktop which I just upgraded as well, only on my laptop. I cant find via google if there is a way to change this. Simply getting access to the browser's default user agent style sheet would suffice. I just upgraded my laptop from 7 to 10 and now the selected text color when typing anything into chrome is killing my eyes. So I'm hoping there's an API for looking up the colors used by various UI elements. One approach might be to render an input with selected text into a canvas and sample the colors, though I haven't investigated whether taking what's essentially a screenshot is possible via an extension without user interaction (the desktopCapture API seems to show a dialog to the user). Given different combinations of platform, OS version and desktop theme, those colors may change from user to user, so simply hard-coding a couple of values isn't sufficient (though that's what I'm doing currently). So I'm wondering if there's an extension API in Chrome that lets JavaScript look up the colors currently being used by the browser for selected text. ![]() I've seen lots of questions about setting the background color of selected text in Chrome and other browsers using the ::selection selector, but I haven't been able to find anything that discusses getting the color currently being used by the browser on the user's OS.įor a Chrome extension I've created a fake input element, and would like to style the "selected" text in that element with the same foreground and background colors as used in real input elements. ![]()
0 Comments
Read More
Leave a Reply. |