OBS: The solution below does not work in the Firefox browser. Check for compatibility in other browsers for this solution. Tests have been done and worked on Google Chrome and Brave browsers.
Thanking @Guilhermenascimento for the observation comment :)
There is a possibility of using the filter
and change the colors of the icon in question.
This response is based on that one and that one question and on Soen, which allows you to make a combinations using filter
and properties such as invert
, sepia
, saturate
, brightness
and hue-rotate
. In the example below, changing the values of hue-rotate
, can result in different colors.
Examples:
- To the
hue-rotate(20deg)
, we will have a reddish color:
input[type="date"]::-webkit-calendar-picker-indicator {
cursor: pointer;
filter: invert(0.8) brightness(50%) sepia(100%) saturate(10000%) hue-rotate(20deg);
}
<input type="date">
- To the
hue-rotate(240deg)
, we will have a bluish color for the icon:
input[type="date"]::-webkit-calendar-picker-indicator {
cursor: pointer;
filter: invert(0.8) brightness(50%) sepia(100%) saturate(10000%) hue-rotate(240deg);
}
<input type="date">
You can still generate different combinations by changing the properties invert
, sepia
, saturate
, brightness
and hue-rotate
.
Note that this works on Chrome and probably on Safari, but does not work on Firefox, of course Firefox does not have such an icon, so the solution applied to Chromium/Webklit will work well. So I leave the +1
– Guilherme Nascimento
@Guilhermenascimento did, but since he used the Webkit, I thought the AP might already be aware of that. But I think it’s worth highlighting your observation in the answer.
– Cmte Cardeal
Has Webkit prefixes that work in Firefox (because "historical questions"). So it’s always good to detail a few things :)
– Guilherme Nascimento