Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mac only] Hair cursor color should be white when using a dark theme. #2743

Open
RaymondLim opened this issue Jul 31, 2014 · 7 comments
Open

Comments

@RaymondLim
Copy link

  1. Open http://codemirror.net/demo/theme.html in a browser.
  2. Select a dark theme like pastel-on-dark.
  3. Move mouse over text and look at the moving hair cursor.

Result: You can barely see the cursor since it is blended into the background color.

@marijnh
Copy link
Member

marijnh commented Aug 2, 2014

Doesn't OS X make sure mouse cursors are visible on all types of backgrounds? If so, maybe we should simply remove the hair cursor feature again (I believe it was contributed by Adobe)?

@peterflynn
Copy link
Contributor

@marijnh It sounds like you might be referring to the crosshair that appears when you hold down Alt? That wasn't contributed by Adobe, but also this bug is about something different -- Raymond is referring to the regular "I beam" mouse cursor that appears any time you mouse over CodeMirror or any other text field.

It does look like this is a Mac OS problem. Windows uses an XOR cursor for this, but Mac seems to use a fixed-color cursor that is hard to see on dark gray backgrounds. I can see the same problem with a plain textarea: http://jsfiddle.net/Qz7F2/

Judging by forum threads like this -- https://discussions.apple.com/message/17250405#17250405 -- it sounds like this is a fact of life on OS X, and the only solution is to supply a custom mouse cursor for widgets that you know have a dark background. (Which, according to the thread, TextMate and Sublime do already).

It looks like CSS cursor allows a url() value, so it might be plausible to do that in CodeMirror (and/or Brackets). We can investigate that and at least create the image assets. Is it something you think would be worth including in CM core?

@marijnh
Copy link
Member

marijnh commented Aug 4, 2014

If you can create a reasonably tiny image url, we can just put it into codemirror.css, and have the dark themes use it.

Although, actually, that might be one of those things that are a pain to do with CSS -- the themes can't force an extra class, and so the style would have to be associated with the themes' classes by including it in every single theme file.

Maybe, though I am not fond of such hacks, use computedStyle to measure the background color, and add a 'cm-dark-theme' class based on that?

@arrbie
Copy link

arrbie commented Jun 2, 2015

We are still waiting for the "I beam" cursor to become visible in dark themes. There is a very pale shadow outline, but that is definitely not enough. We would really like a white "I beam" cursor. Any progress on this?

@marijnh
Copy link
Member

marijnh commented Jun 11, 2015

Are you talking about the regular 'text' cursor when you say 'i beam'? Is that one also hard to spot on dark backgrounds on Macs? (Wasn't this company supposed to be good at design?)

@marijnh
Copy link
Member

marijnh commented Jun 11, 2015

[Pointlessly abusive comment removed]

@peterflynn
Copy link
Contributor

@arrbie Please see the links I posted above. This is a limitation of Mac OS -- every app that wants to not have this problem needs to supply its own solution. Chrome didn't do that extra work to fix this; that's not CodeMirror's fault or Brackets's fault. Though we could put in extra effort to work around it, every text field on the web would need the same workaround so it seems much more sensible for Chrome or the OS itself to fix this.

That said, it looks like OS X 10.10 or a recent version of Chrome has actually fixed this, since I don't see this bug anymore either Brackets, CodeMirror, or my simple JSFiddle link above.

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

No branches or pull requests

4 participants