要设置光标颜色,请使用CSS caret-color属性。您可以尝试运行以下代码来实现caret-color属性
<!DOCTYPE html>
<html>
<head>
<style>
.demo {
caret-color: blue;
}
</style>
</head>
<body>
<p>Place the mouse cursor below to see a blue color cursor</p>
<input class = "demo" value="Blue Cursor"><br><br>
</body>
</html>