

Go to ios/MyApp/AppDelegate.m and before add: = įinally, rebuild the apps to see the result of your edits. Go to android/app/src/main/res/values/styles.xml and add the following lines to the custom section: #FF0000 Therefore, the right way to change the cursor color is by editing the native settings instead.

Any input field or textarea embedded in WebView components will get the default cursor color on both platforms.On Android, highlighted text gets the same bright color as the cursor, and the drop-shaped guides below highlighted text are still stuck with the default color.

However in IE it has no effect whatsoever. = 'red' Īs of RN 0.63, this solution is still inefficient for at least two reasons: How do I change the color of the text cursor in an input field in IE Ask Question Asked 14 years, 3 months ago Modified 1 year, 6 months ago Viewed 15k times 12 From what I saw, in Firefox and Chrome, the color of the text cursor in an input field changes to the value of the color css property.

It also depends what you mean by "cursor": the mouse pointer? The text-position marker? The actual cursor (the often-flashing vertical line that marks the text-input position)? Because the actual cursor will only be displayed in an editable element (as above), because it marks a text-input position and there isn't one of those at all if the text element doesn't accept user input.Many here suggested using selectionColor: import from 'react-native' So, whatever background it's on, it remains visible. On my system, for example, the pointer is a black arrow with a white outline, and the text marker similarly has an outline. The default cursor shapes and colours depend ultimately on the reader (i.e. There are ways to set a custom cursor, but I don't think that's your problem here. PreCode::selection in your CSS.Īlso, bear in mind that the way the cursor is rendered on screen depends on your browser and also your operating system. (And, I suspect that you mean "invisible" rather than "transparent" - unless you actually see transparency being applied, but I suspect it's just that you can't see it against the dark background.)ĭo you mean that you want the background colour of the highlighted text to be different from the default? In which case you need to set the background-color property for. So, if you apply is to a div (as here), you'll get unexpected results. The caret-color property is only supposed to apply to input elements and similar - elements that are intended to be user editable. Quibusdam dolorem eos sunt voluptate neque, unde expedita, error modi, assumenda quisquam repudiandae iste provident rerum vel blanditiis. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Is there any way to prevent this from happening? Is there a way to change the color of the text-cursor to the color of the cursor i.e red? Now when ever I try to focus the text written inside of a element with this as the class my text cursor becomes transparent. Recently, I came across a problem where my text-cursor is not visible when the background-color of a element is darkish.įont-family: Georgia, 'Times New Roman', Times, serif I am currently new to HTML and CSS and do not have much knowledge about them.
