I have an HTML dropdown menu with the first option disabled. I would like to show that the option is disabled by default in gray, but as soon as I select a different value, I would like it to be blue. How can I achieve this?

I managed to get the selected option as gray, and the selected options will appear as blue in the list. But both disabled and non-disabled options will appear gray anyway after they are selected:
select:not(:checked) {
color: gray;
}
select option:not(:disabled){
color: #000098;
}
source
share