Comments (2)
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:
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.
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)
- [Feature Request] Dark mode on documentation. HOT 4
- Translated country name is passed in few instances HOT 2
- Typescript definitions wrong with 21.2.6 HOT 9
- InitialValue in react component does not set the number and country state values. HOT 2
- Unable to resolve path to module 'intl-tel-input/react' HOT 8
- isValidNumber not working when util.js is pre-loaded (not lazy loaded) in v22.0.2 HOT 6
- Demo with javascript locacles HOT 4
- Arabic locale HOT 6
- Invalid country data for French overseas territories HOT 2
- Convert flags.png to AVIF format to comply with PageSpeed Insights recommendation HOT 7
- New Country to be added => Artsakh | 374 47, 374 97 HOT 2
- U.S. is not showing the u.s. flag HOT 10
- Question about strictMode HOT 3
- Validation doesn't work for some phone numbers from Germany HOT 2
- utilsScript fails to load the utils from CDN in Next.js app HOT 13
- This input doesn't work on two elements HOT 3
- Getting error while using utilsScript HOT 6
- React component - allow access to intlTelInput instance HOT 14
- [Webpack] Compilation warning when initializing `intlTelInput` with `utilsScript` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from intl-tel-input.