简体   繁体   English

Ionic3:更改输入字段中的光标颜色

[英]Ionic3: Change cursor color in input fields

How can I change the color of the cursor for text-input-fields in my Ionic 3 app on android (or however to call the marker that lets you move to a desired position in some text)? 如何在Android上的Ionic 3应用程序中更改文本输入字段的光标颜色(或者调用可以让您移动到某些文本中所需位置的标记)? As you can see from the following screenshot, the cursor is currently green. 从下面的屏幕截图中可以看出,光标当前是绿色的。 In other Input-fields it is blue. 在其他输入字段中,它是蓝色的。 I want to change it to my primary color. 我想把它改成我的原色。

http://i.imgur.com/yTc6QZT.png

Any help would be appreciated. 任何帮助,将不胜感激。

BTW: What type of input are you talking about? BTW:你在谈论什么类型的投入?

<ion-input> 
<ion-searchbar>
<input>

There was also this post on caret's because you said cursor. 也有关于插入符号的帖子,因为你说光标。 This was admittedly Mozilla focused, There is a W3C draft for this. 不可否认的是, Mozilla专注于此,有一个W3C草案 The CSS caret-color CSS 插入颜色

You might also check out src/theme/variables.scss in your project explorer 您也可以在项目资源管理器中查看src / theme / variables.scss
And here in the documentation 在文档中
But I suspect that might not yield much. 但我怀疑这可能不会产生太大影响。 Filtering based on search terms of 'input','color', or 'md' in the documentation, would be my stab at it. 根据文档中“输入”,“颜色”或“md”的搜索条件进行过滤,这将是我的努力。

In case Anyone is looking for the answer: 如果有人正在寻找答案:

In the browser you can use 'caret-color: red' over the '.item-inner' class inside the input, but in Android and IOS wont work. 在浏览器中,你可以在输入中的'.item-inner'类上使用'caret-color:red',但在Android和IOS中不会工作。

The way to do it for them is in the .input class like this: 为它们执行此操作的方法是在.input类中,如下所示:

input {
  color: rgb(60, 0, 248);  /* change [input cursor color] by this*/
  text-shadow: 0px 0px 0px #D60B0B; /* change [input font] by this*/
  -webkit-text-fill-color: transparent; //This changes the color of the text in the input
}

This solution comes from this links: https://gist.github.com/JoeKeikun/72718f5faaf518304024 此解决方案来自以下链接: https//gist.github.com/JoeKeikun/72718f5faaf518304024

Hope it helps ;) 希望能帮助到你 ;)

if you are looking for that green line fix, then you can work around outline/border color, so my approach would be, on focus 如果你正在寻找绿线修复,那么你可以解决轮廓/边框颜色,所以我的方法是,焦点

#yourInput:focus{
  border-color : blue;
  //outline-color : blue:
}

Hope it helps :) 希望能帮助到你 :)

只需使用CSS进行搜索输入即插入颜色请点击此链接获取更多详细信息CSS插入颜色

将此添加到您的输入:

caret-color: #ffffff;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM