YASBDocs

Theme#

import Yasb.Themes · inherits QtObject

The colors, fonts and shapes the bar and its widgets share. A theme file's root is Theme, and it sets only what it changes: everything else keeps the default listed here.

Guide: Themes

Example#

This theme changes the accent and critical colors, rounds the popups more and opens them faster, and makes the right-click menus' text larger:

// %USERPROFILE%\.config\yasb\themes\mine.qml
import QtQuick
import Yasb.Themes

Theme {
    colors {
        accent: "#4CC2FF"
        critical: dark ? "#FF99A4" : "#C42B1C"
    }

    popup {
        radius: 12
        openDuration: 120
    }

    menu {
        font.pixelSize: 14
    }
}
theme: mine

A widget reads its bar's theme as bar.theme, and a layout as theme:

Label {
    text: "CPU"
    color: root.bar.theme.colors.textSecondary
}

Theme#

colors, bar, popup and menu are groups. You can't replace a group, but you set the values inside it, as the example does. Inside a theme file you can use dark and system directly, without a prefix.

Properties#

dark : bool read-only#

true while Windows is in dark mode. It updates when you switch modes. Write a value as dark ? A : B to have A in dark mode and B in light mode.

system : SystemPalette read-only#

Windows' own colors. system.accent is the accent color set in Windows.

colors : Colors read-only#

See Colors.

bar : Bar read-only#

See Bar.

See Popup.

See Menu.

Theme has no functions or signals.

Colors#

text through textDisabled go from the most prominent text to the least.

Properties#

text : color#

The strongest text, such as labels and titles.

Default: dark ? "#FFFFFF" : Qt.alpha("#000000", 0.894)

textSecondary : color#

Text less prominent than text.

Default: dark ? Qt.alpha("#FFFFFF", 0.773) : Qt.alpha("#000000", 0.62)

textTertiary : color#

Text less prominent than textSecondary.

Default: dark ? Qt.alpha("#FFFFFF", 0.53) : Qt.alpha("#000000", 0.447)

textDisabled : color#

The least prominent text, for disabled items.

Default: dark ? Qt.alpha("#FFFFFF", 0.365) : Qt.alpha("#000000", 0.36)

textOnAccent : color#

Text and icons on an accent fill.

Default: dark ? "#000000" : "#FFFFFF"

background : color#

The base color for the bar and popups.

Default: dark ? "#202020" : "#F3F3F3"

backgroundSecondary : color#

A slightly darker area on top of background.

Default: dark ? Qt.alpha("#000000", 0.1) : Qt.alpha("#000000", 0.024)

card : color#

Boxes that group related content.

Default: dark ? Qt.alpha("#FFFFFF", 0.05) : Qt.alpha("#FFFFFF", 0.7)

cardBorder : color#

The outline of a card.

Default: dark ? Qt.alpha("#000000", 0.1) : Qt.alpha("#000000", 0.06)

border : color#

The outer edges of the bar, popups and menus.

Default: dark ? "#3A3A3A" : "#D9D9D9"

divider : color#

Lines between the parts of a popup, such as under its header.

Default: dark ? Qt.alpha("#FFFFFF", 0.08) : Qt.alpha("#000000", 0.06)

hover : color#

An overlay fill, on any background, for the item under the pointer.

Default: dark ? Qt.alpha("#FFFFFF", 0.06) : Qt.alpha("#000000", 0.035)

pressed : color#

An overlay fill, on any background, for an item while pressed.

Default: dark ? Qt.alpha("#FFFFFF", 0.04) : Qt.alpha("#000000", 0.024)

selected : color#

An overlay fill, on any background, behind the selected or current item.

Default: dark ? Qt.alpha("#FFFFFF", 0.06) : Qt.alpha("#000000", 0.035)

control : color#

A button's fill at rest.

Default: dark ? Qt.alpha("#FFFFFF", 0.06) : Qt.alpha("#FFFFFF", 0.7)

controlHover : color#

A button's fill under the pointer.

Default: dark ? Qt.alpha("#FFFFFF", 0.08) : Qt.alpha("#F9F9F9", 0.5)

controlPressed : color#

A button's fill while pressed.

Default: dark ? Qt.alpha("#FFFFFF", 0.03) : Qt.alpha("#F9F9F9", 0.3)

controlBorder : color#

A button's outline.

Default: dark ? Qt.alpha("#FFFFFF", 0.07) : Qt.alpha("#000000", 0.06)

smoke : color#

An overlay that dims a popup's content behind something opened over it, such as a group.

Default: Qt.alpha("#000000", 0.3)

accent : color#

The accent color.

Default: system.accent, the accent color set in Windows

success : color#

Default: dark ? "#6CCB5F" : "#0F7B0F"

warning : color#

Default: dark ? "#FCE100" : "#9D5D00"

critical : color#

Default: dark ? "#FF99A4" : "#C42B1C"

Bar#

The bar itself, and the labels and icons of the widgets on it.

Properties#

background : color#

The bar's fill, unless a layout sets its own color.

Default: Qt.alpha(colors.background, 0.85)

border : color#

The bar's outline. It shows only where a layout gives the border a width.

Default: colors.border

font : font#

The font for widget labels on the bar. Every Label in a widget uses it for each font property the widget doesn't set itself.

Default: family "Segoe UI", pixelSize 13

iconFont : font#

The font for widget icons on the bar and in popups. A widget's iconSize sets their size on the bar.

Default: family "Segoe Fluent Icons", pixelSize 16

The popups that widgets open.

Properties#

background : color#

Default: Qt.alpha(colors.background, 0.85)

border : color#

Default: colors.border

radius : real#

Default: 8

gap : real#

The space between the bar and the popup.

Default: 8

openDuration : int#

Milliseconds a popup takes to open.

Default: 180

closeDuration : int#

Milliseconds a popup takes to close.

Default: 140

font : font#

Only its family is used: each widget sets the sizes and weights of its own popup text.

Default: family "Segoe UI"

iconFont : font#

The font for icons in popups. Each widget sets their sizes.

Default: family "Segoe Fluent Icons"

The right-click menus.

Properties#

background : color#

Default: dark ? "#2C2C2C" : "#F9F9F9"

border : color#

Default: colors.border

radius : real#

Default: 8

font : font#

Default: family "Segoe UI", pixelSize 13

openDuration : int#

Milliseconds a menu takes to fade in.

Default: 150

Used by#

Every bar, the bar menu, and the options of the built-in widgets, whose defaults come from the theme.