1

How can I change the icon color of the native HTML5 date input (<input type="date" />)? Is it possible to change the calendar icon color to HEX: #018bee or RGB: (1, 139, 238)? I saw a post saying that it was possible using filters, but I was unsuccessful.

enter image description here

Codepen Example: https://codepen.io/gerisd/pen/VwPzqMy

HTML:

 <input type="date" id="deadline" name="deadline" value="2021-01-01" required>

CSS:

#deadline{
  width: 100%;
  min-width: 100px;
  border: none;
  height: 100%;
  background: none;
  outline: none;
  padding-inline: 5px;
  resize: none;
  border-right: 2px solid #dde2f1;
  cursor: pointer;
  color: #9fa3b1;
  text-align: center;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  border-radius: 4px;
  margin-right: 2px;
  filter: invert(0.8) sepia(100%) saturate(10000%) hue-rotate(240deg);
}
Martin
  • 5,714
  • 2
  • 21
  • 41
David
  • 77
  • 3
  • 11

1 Answers1

2

Have you tried using webkit? I found a similar qustion from enter link description here

try this code from that question maybe:

::-webkit-calendar-picker-indicator {
filter: invert(1);

}

steak
  • 23
  • 6