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.
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);
}