jackocnr / intl-tel-input

A JavaScript plugin for entering and validating international telephone numbers
https://intl-tel-input.com
MIT License
7.38k stars 1.93k forks source link

Dark Mode Support #1608

Closed udit-001 closed 2 months ago

udit-001 commented 2 months ago

Great plugin! I love how simple it is to use.

Are there any plans to add a dark theme to the plugin? Perhaps one that automatically adjusts based on users' browser preferences?

jackocnr commented 2 months ago

Great plugin! I love how simple it is to use.

❤️

Are there any plans to add a dark theme to the plugin?

No plans, but I would welcome a PR that added this!

jackocnr commented 2 months ago

After playing with this a little bit, I realised 3 things that put me off the idea of providing built-in dark mode support:

@media (prefers-color-scheme: dark) {
  .iti {
    --iti-arrow-color: #bababa;
  }
  .iti input, .iti__dropdown-content {
    background-color: #212529;
  }
}

Which produces the following styles:

Screenshot 2024-05-11 at 08 45 02

So for these reasons, I've decided not to add built-in dark mode support, and instead will leave it to each dev to add this themselves, based on the above snippet, customised to match their own dark colour scheme.