Giter VIP home page Giter VIP logo

Comments (2)

jackocnr avatar jackocnr commented on June 16, 2024 1

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

  • The CSS media query for dark mode @media (prefers-color-scheme: dark) will enable dark mode based on the user's OS system settings, BUT most websites that use this plugin won't be respecting this, and so if the plugin starts respecting this on its own, most websites will end up with a dark plugin on a light website which will look silly.
  • When dark mode is enabled, the background colour for the plugin input and dropdown need to match the page background colour, which is normally some shade of dark grey, but it varies massively, and there's no easy way for the plugin to determine what that is
  • It's actually really easy to add this yourself - the simplest version is just 2 CSS rules - see example below:
@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.

from intl-tel-input.

jackocnr avatar jackocnr commented on June 16, 2024

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!

from intl-tel-input.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.