Set entire app to Dark Theme?



  • Hi Everyone,

    Just beginning to explore Quasar and I’m wondering if you can easily set the entire app to be a dark theme (and therefore automatically default all text to white). This was something available in AngularJS-Material and was quite handy.

    I have changed the $body-color Stylus variable as well as learning that I can add the ‘dark’ property on inputs etc but obviously it’s not the ideal solution to have to add that to all inputs.

    There are no Stylus variables for the color of inputs so any expert suggestions would be greatly appreciated.

    I assume some sort of global CSS rules would be the final solution but a dark theme setting would be great!

    Thanks a lot.



  • I want this too. Just leaving this comment here to get notified if anything changes.



  • Yes I would love this as well. Bootstrap has something called variant=“dark” to make it dark. and text automatically light. Now I could add just a class called .dark with card .dark etc, but it would be awesome if there are some themes in there for dark and light flavors.



  • Hi,

    I believe there is contemplation being made for a global dark setting, but until then, I’d like to offer this thought. The OP wrote this:

    I can add the ‘dark’ property on inputs etc but obviously it’s not the ideal solution to have to add that to all inputs.

    I don’t mean to be disrespectful, but this shows a sort of incorrect perspective on what Quasar is offering or rather, what Vue is offering with the SFC system. You don’t have to add the dark prop to all of your inputs, but rather, you should design your own input component only once, with whatever other design or logic you need, and then use your component multiple times in your forms and not Quasar’s, (which means not needing to add the dark prop logic multiple times).

    You see, if you think about that, offering a global dark prop won’t help you much, if you are building out your own components. And you really should build out your own components, because of the main reason mentioned above, and that is for your own DRY code. 🙂

    Just to hit this slight paradigm shift a bit more home. Look at QSelect and the number of things you can do with it. Autocomplete, Filtered Selection, Chips Selection, and more. Imagine having to “set up” each use of QSelect for each use case in multiple forms. That would be ridiculous, right? The solution is to create your own select components, each one doing one use case, but only once! (oh, and with dark prop logic too!) 😁

    I hope that gets your mental juices in a whirl. 👍

    Scott



  • And, if you have some time on your hands and want to see what I mean in action (not about dark props, but with extending Quasar’s components), have a look at this article.

    https://medium.com/quasar-framework/component-building-with-quasar-fc101b6730ae

    Scott



  • @s-molinari I actually did read that article, after I wrote this post, and it did help me design my components in a cleaner, dryer, more Vue-like fashion, so thank you. Adding the ‘dark’ property is not a big deal, but there are multiple components that default to white, such as QCard, QDialog, etc which all have to be addressed with CSS.

    What this means is that anybody who wants to jump in and start building their brand new Quasar app with a darker colour scheme are immediately met with a set of micro-puzzles regarding which classes to target with CSS. Given that the Material Spec includes the full spectrum of potential colour schemes, I think it would be very worthwhile offering an easy way to create a global dark theme. Mac OS, Outlook and Chrome Dev Tools have all recently added dark modes, so grey is the new black, apparently.



  • @Jezzta667 - Yes, I dislike going from dark to something light now. I even tried going completely “dark” with Windows 10. Ugh… that failed, as you can imagine. 😁

    QCard and QDialog both have dark props, but only affect the text color on purpose. Maybe your dark is a blue? Again, this means you have to create your own “dark”. 🙂

    I know you understand this @Jezzta667, but for others just coming to Quasar and looking for the “easy way out”, here is what I mean and what you’ll end up having to do to get dark working.

    https://codepen.io/smolinari/pen/GzPOZR

    You still have to do initial work, but after that, you’ll have your own “style” rolling. Notice the reuse of my my-card component. 😉

    Scott