On this page

CustomTheme QML Type

Defines a named custom theme. More...

Import Statement: import Qt.labs.StyleKit
Status: Technology preview

This type is in technology preview and is subject to change.

Properties

Detailed Description

CustomTheme lets you add additional themes beyond light and dark. While the light and dark themes are applied automatically based on the operating system's color scheme, a CustomTheme must be activated explicitly by the application. Apart from this difference, all themes work the same way.

You can define any number of custom themes inside a Style.

Style {
    CustomTheme {
        name: "HighContrast"
        theme: Theme {
            control.background.color: "white"
            control.background.border.color: "black"
            control.background.border.width: 2
        }
    }

    CustomTheme {
        name: "Sepia"
        theme: Theme {
            control.text.color: "#5b4636"
            control.background.color: "#f4ecd8"
            control.background.border.color: "#c8b99a"
            applicationWindow.background.color: "#efe6d0"
        }
    }
}

To activate a CustomTheme, set Style::themeName to its name from the application:

ComboBox {
    model: StyleKit.style.themeNames
    onCurrentTextChanged: StyleKit.style.themeName = currentText
}

You can also set a CustomTheme as the default theme at start-up:

ApplicationWindow {
    width: 1024
    height: 800
    visible: true

    StyleKit.style: MyStyleKitStyle {
        themeName: "HighContrast"
    }
}

The custom themes defined in a Style can be queried at runtime from Style::customThemeNames or Style::themeNames.

Note: Types in Qt.labs modules are not guaranteed to remain compatible in future versions.

See also Theme, Style::themeName, and Style::customThemeNames.

Property Documentation

name : string

The name of this theme. This is the value you assign to Style::themeName to activate it.

theme : Component

The Theme component that defines the theme. It will only be instantiated when the theme is activated.

Properties not set in the theme fall back to those defined in the Style.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.