Akash Agarwal
Akash Agarwal

Reputation: 2530

QML Material Design colors aren't accurate

I'm trying to use the Purple and other colors specified on this page but the colors aren't displaying accurately.
This is the image of Purple color being displayed on my device as well as linux:

enter image description here

Here are the relevant code snippets from the default Hello World app:
.pro file:

QT += qml quick quickcontrols2

main.cpp:

#include <QQuickStyle>

In int main(int argc, char *argv[])
QQuickStyle::setStyle("Material");

main.qml:

Material.theme: Material.Dark
Material.accent: Material.Purple

Upvotes: 4

Views: 2326

Answers (1)

jpnurmi
jpnurmi

Reputation: 5836

The Material Design specs are a bit inconsistent about this. In the sticker sheet, all buttons are using such lighter shade in the dark theme, whereas elsewhere in the specs they are mostly using the same darker shade than in the light theme. We're considering switching it back, but meanwhile, here's a temporary workaround using Material.color():

Material.theme: Material.Dark
Material.accent: Material.color(Material.Purple)
  • QTBUG-54269: Material colors don't work as documented

Upvotes: 6

Related Questions