# Register QML Singletone in CP

Let's get started&#x20;

1. Create .qml file and the use&#x20;

```qml
pragma Singleton // We indicate that this QML Type is a singleton
import QtQuick 2.15

QtObject {
    readonly property bool isDarkMode: cSettings.isDark // this is the cpp contextProperty()
    readonly property color footerBackground:"#0E0E0E" // isDarkMode ? "#0E0E0E" : "#FFFFFF"
    readonly property color background: isDarkMode ? "#0E0E0E" : "#F1F1F1"
    readonly property color fontColor: isDarkMode ? "#FFFFFF" : "#0E0E0E"

    /*Dashboard Propertes*/

    readonly property color backgroundColor:"#17161c"
    readonly property color footerColor:"#201f25"
    readonly property color forgroundColor:"#201f25"
    readonly property color buttonColor:"#2f2f39"
    readonly property color labledBackColor:"#2c2c34"
    readonly property color checkedIconColor:"#489eeb"
    readonly property color unCheckedIconColor :"#777781"
    readonly property color progressColor:"#2f2f39"
    readonly property color tileColor :"#439df3"
}

```

Now it's time to register in cpp&#x20;

```cpp
qmlRegisterSingletonType(QUrl("qrc:/Theme.qml"), "Theme", 1, 0, "Theme");
```

Now it's time to use this library using&#x20;

```qml
import Theme 1.0

Label{
    text:"Adesh Singh"
    color: Theme.fontColor
    }
```
