Add tooltip color tokens

This commit is contained in:
Ryan Hughes
2026-05-19 15:16:10 -04:00
parent 441072db52
commit 15f461c1df
13 changed files with 34 additions and 46 deletions
+6
View File
@@ -75,6 +75,12 @@ base-size = 12
background = "{{ background }}" background = "{{ background }}"
border = "{{ accent }}" border = "{{ accent }}"
[tooltip]
# Hover tooltips across the bar, panels, and buttons.
background = "{{ background }}"
text = "{{ foreground }}"
border = "{{ foreground }}"
[notifications] [notifications]
background = "{{ background }}" background = "{{ background }}"
text = "{{ foreground }}" text = "{{ foreground }}"
+2 -1
View File
@@ -115,7 +115,8 @@ The shell exposes these tokens to QML via two singletons in
- `Color` — palette (`foreground`, `background`, `accent`, `urgent`) - `Color` — palette (`foreground`, `background`, `accent`, `urgent`)
and per-surface roles (`Color.bar.*`, `Color.popups.*`, and per-surface roles (`Color.bar.*`, `Color.popups.*`,
`Color.notifications.*`, `Color.menu.*`, `Color.imagePicker.*`). `Color.tooltip.*`, `Color.notifications.*`, `Color.menu.*`,
`Color.imagePicker.*`).
- `Style` — structural tokens (`cornerRadius`), shared interactive - `Style` — structural tokens (`cornerRadius`), shared interactive
state tokens/helpers, spacing (`Style.spacing.*` / `Style.space(px)`), state tokens/helpers, spacing (`Style.spacing.*` / `Style.space(px)`),
the type scale (`Style.font.*`), and bar dimensions the type scale (`Style.font.*`), and bar dimensions
+8 -2
View File
@@ -5,8 +5,9 @@ import Quickshell.Io
// Single source of truth for shell color surfaces. Top-level tokens // Single source of truth for shell color surfaces. Top-level tokens
// (foreground/background/accent/urgent) come from the theme's colors.toml. // (foreground/background/accent/urgent) come from the theme's colors.toml.
// Per-surface roles (Color.bar.*, Color.popups.*, Color.notifications.*, // Per-surface roles (Color.bar.*, Color.popups.*, Color.tooltip.*,
// Color.menu.*, Color.imagePicker.*) come from shell.toml, which is generated // Color.notifications.*, Color.menu.*, Color.imagePicker.*) come from
// shell.toml, which is generated
// per theme from default/themed/shell.toml.tpl (or shipped directly by a // per theme from default/themed/shell.toml.tpl (or shipped directly by a
// theme to override). Surfaces that don't appear in shell.toml fall back to // theme to override). Surfaces that don't appear in shell.toml fall back to
// the foundational palette, so themes can ship partial overrides. // the foundational palette, so themes can ship partial overrides.
@@ -40,6 +41,11 @@ QtObject {
property color background: root.pick("popups.background", root.background) property color background: root.pick("popups.background", root.background)
property color border: root.pick("popups.border", root.pick("notifications.border", root.accent)) property color border: root.pick("popups.border", root.pick("notifications.border", root.accent))
} }
readonly property QtObject tooltip: QtObject {
property color background: root.pick("tooltip.background", root.background)
property color text: root.pick("tooltip.text", root.foreground)
property color border: root.pick("tooltip.border", root.foreground)
}
readonly property QtObject notifications: QtObject { readonly property QtObject notifications: QtObject {
property color background: root.pick("notifications.background", root.background) property color background: root.pick("notifications.background", root.background)
property color text: root.pick("notifications.text", root.foreground) property color text: root.pick("notifications.text", root.foreground)
+7 -4
View File
@@ -46,9 +46,12 @@ Rectangle {
property real verticalPadding: Style.spacing.controlPaddingY property real verticalPadding: Style.spacing.controlPaddingY
property bool leftAlign: false property bool leftAlign: false
// Tooltip palette. Auto-rendered if tooltipText is set. // Tooltip palette. Auto-rendered if tooltipText is set. Defaults pull
property color tooltipBackground: Color.background // from [tooltip] in shell.toml; override per-instance only when a button
property color tooltipForeground: foreground // intentionally wants a tooltip that diverges from the theme.
property color tooltipBackground: Color.tooltip.background
property color tooltipForeground: Color.tooltip.text
property color tooltipBorder: Color.tooltip.border
signal clicked() signal clicked()
signal rightClicked() signal rightClicked()
@@ -102,7 +105,7 @@ Rectangle {
padding: 0 padding: 0
background: Rectangle { background: Rectangle {
color: root.tooltipBackground color: root.tooltipBackground
border.color: root.tooltipForeground border.color: root.tooltipBorder
border.width: Math.max(1, Style.normalBorderWidth) border.width: Math.max(1, Style.normalBorderWidth)
radius: 0 radius: 0
opacity: 0.97 opacity: 0.97
-3
View File
@@ -31,7 +31,6 @@ Rectangle {
property string tooltipText: "" property string tooltipText: ""
property color foreground: Color.foreground property color foreground: Color.foreground
property color hoverColor: foreground property color hoverColor: foreground
property color panelBackground: Color.background
property string fontFamily: Style.font.family property string fontFamily: Style.font.family
property real fontSize: Style.font.icon property real fontSize: Style.font.icon
property real size: Math.max(Style.space(22), fontSize + Style.spacing.sm * 2) property real size: Math.max(Style.space(22), fontSize + Style.spacing.sm * 2)
@@ -99,8 +98,6 @@ Rectangle {
PanelToolTip { PanelToolTip {
visible: root.tooltipText !== "" && mouse.containsMouse visible: root.tooltipText !== "" && mouse.containsMouse
text: root.tooltipText text: root.tooltipText
panelForeground: root.foreground
panelBackground: root.panelBackground
fontFamily: root.fontFamily fontFamily: root.fontFamily
} }
} }
+8 -6
View File
@@ -7,18 +7,20 @@ import qs.Commons
// PanelToolTip { // PanelToolTip {
// visible: mouse.containsMouse // visible: mouse.containsMouse
// text: "Forget network" // text: "Forget network"
// panelForeground: bar.foreground
// panelBackground: bar.background
// fontFamily: bar.fontFamily
// } // }
// //
// Defaults pull from [tooltip] in shell.toml via Color.tooltip.*. Override
// the panel* properties per-instance only when you need a tooltip that
// intentionally diverges from the theme.
//
// Property names are prefixed `panel*` to avoid clashing with ToolTip's // Property names are prefixed `panel*` to avoid clashing with ToolTip's
// built-in `background`/`font` properties. // built-in `background`/`font` properties.
ToolTip { ToolTip {
id: root id: root
property color panelForeground: Color.foreground property color panelForeground: Color.tooltip.text
property color panelBackground: Color.background property color panelBackground: Color.tooltip.background
property color panelBorder: Color.tooltip.border
property string fontFamily: Style.font.family property string fontFamily: Style.font.family
property real fontSize: Style.font.bodySmall property real fontSize: Style.font.bodySmall
@@ -27,7 +29,7 @@ ToolTip {
background: Rectangle { background: Rectangle {
color: root.panelBackground color: root.panelBackground
border.color: Style.normalBorderFor(root.panelForeground, Color.accent) border.color: root.panelBorder
border.width: Style.normalBorderWidth border.width: Style.normalBorderWidth
radius: Style.cornerRadius radius: Style.cornerRadius
opacity: 0.97 opacity: 0.97
+3 -3
View File
@@ -683,8 +683,8 @@ Item {
id: tooltipBubble id: tooltipBubble
implicitWidth: tooltipLabel.implicitWidth + 20 implicitWidth: tooltipLabel.implicitWidth + 20
implicitHeight: tooltipLabel.implicitHeight + 14 implicitHeight: tooltipLabel.implicitHeight + 14
color: root.background color: Color.tooltip.background
border.color: root.foreground border.color: Color.tooltip.border
border.width: 1 border.width: 1
radius: Style.cornerRadius radius: Style.cornerRadius
opacity: 0.97 opacity: 0.97
@@ -693,7 +693,7 @@ Item {
id: tooltipLabel id: tooltipLabel
anchors.centerIn: parent anchors.centerIn: parent
text: root.tooltipText text: root.tooltipText
color: root.foreground color: Color.tooltip.text
font.family: root.fontFamily font.family: root.fontFamily
font.pixelSize: Style.font.body font.pixelSize: Style.font.body
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
@@ -516,8 +516,6 @@ Item {
property bool pillEnabled: true property bool pillEnabled: true
signal activated() signal activated()
tooltipBackground: root.bar.background
tooltipForeground: root.bar.foreground
foreground: root.bar.foreground foreground: root.bar.foreground
fontFamily: root.bar.fontFamily fontFamily: root.bar.fontFamily
horizontalPadding: Style.spacing.md horizontalPadding: Style.spacing.md
@@ -685,7 +683,6 @@ Item {
tooltipText: row.isConnected ? "Disconnect" : "Forget" tooltipText: row.isConnected ? "Disconnect" : "Forget"
foreground: root.bar.foreground foreground: root.bar.foreground
hoverColor: root.bar.urgent hoverColor: root.bar.urgent
panelBackground: root.bar.background
fontFamily: root.bar.fontFamily fontFamily: root.bar.fontFamily
onClicked: { onClicked: {
if (!row.dev) return if (!row.dev) return
@@ -500,8 +500,6 @@ Item {
text: modelData + "x" text: modelData + "x"
foreground: root.bar.foreground foreground: root.bar.foreground
background: "transparent" background: "transparent"
tooltipBackground: root.bar.background
tooltipForeground: root.bar.foreground
fontFamily: root.bar.fontFamily fontFamily: root.bar.fontFamily
fontSize: Style.font.bodySmall fontSize: Style.font.bodySmall
horizontalPadding: 0 horizontalPadding: 0
@@ -748,7 +748,6 @@ fi
tooltipText: "Toggle Wi-Fi" tooltipText: "Toggle Wi-Fi"
foreground: root.bar.foreground foreground: root.bar.foreground
hoverColor: root.bar.foreground // Override the dimming behavior hoverColor: root.bar.foreground // Override the dimming behavior
panelBackground: root.bar.background
fontFamily: root.bar.fontFamily fontFamily: root.bar.fontFamily
enabled: true enabled: true
onClicked: { onClicked: {
@@ -805,7 +804,6 @@ fi
tooltipText: "Disconnect" tooltipText: "Disconnect"
foreground: root.bar.foreground foreground: root.bar.foreground
hoverColor: root.bar.urgent hoverColor: root.bar.urgent
panelBackground: root.bar.background
fontFamily: root.bar.fontFamily fontFamily: root.bar.fontFamily
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
onHovered: function(h) { onHovered: function(h) {
@@ -823,8 +821,6 @@ fi
iconText: "󰑐" iconText: "󰑐"
iconSpinning: root.scanning iconSpinning: root.scanning
tooltipText: "Refresh" tooltipText: "Refresh"
tooltipBackground: root.bar.background
tooltipForeground: root.bar.foreground
foreground: root.bar.foreground foreground: root.bar.foreground
horizontalPadding: Style.spacing.controlGap horizontalPadding: Style.spacing.controlGap
verticalPadding: Style.spacing.labelGap verticalPadding: Style.spacing.labelGap
@@ -1005,8 +1001,6 @@ fi
text: provider text: provider
foreground: root.bar.foreground foreground: root.bar.foreground
tooltipBackground: root.bar.background
tooltipForeground: root.bar.foreground
fontFamily: root.bar.fontFamily fontFamily: root.bar.fontFamily
horizontalPadding: Style.spacing.controlPaddingX horizontalPadding: Style.spacing.controlPaddingX
verticalPadding: Style.spacing.controlPaddingY verticalPadding: Style.spacing.controlPaddingY
@@ -1153,7 +1147,6 @@ iwctl known-networks list 2>/dev/null \\
tooltipText: "Forget network" tooltipText: "Forget network"
foreground: root.bar.foreground foreground: root.bar.foreground
hoverColor: root.bar.urgent hoverColor: root.bar.urgent
panelBackground: root.bar.background
fontFamily: root.bar.fontFamily fontFamily: root.bar.fontFamily
onClicked: if (row.net) root.forget(row.net.ssid) onClicked: if (row.net) root.forget(row.net.ssid)
} }
@@ -1296,7 +1289,6 @@ iwctl known-networks list 2>/dev/null \\
iconText: "󰄬" iconText: "󰄬"
tooltipText: "Connect" tooltipText: "Connect"
foreground: root.bar.foreground foreground: root.bar.foreground
panelBackground: root.bar.background
fontFamily: root.bar.fontFamily fontFamily: root.bar.fontFamily
onClicked: if (row.net) root.connectWithPassphrase(row.net.ssid, pwField.text) onClicked: if (row.net) root.connectWithPassphrase(row.net.ssid, pwField.text)
} }
@@ -1370,8 +1362,6 @@ iwctl known-networks list 2>/dev/null \\
PanelToolTip { PanelToolTip {
visible: valueMouse.enabled && valueMouse.containsMouse visible: valueMouse.enabled && valueMouse.containsMouse
text: tooltipText text: tooltipText
panelForeground: root.bar.foreground
panelBackground: root.bar.background
fontFamily: root.bar.fontFamily fontFamily: root.bar.fontFamily
} }
} }
-2
View File
@@ -280,8 +280,6 @@ printf 'time\t%s\n' "$($OMARCHY_PATH/bin/omarchy-battery-remaining-time 2>/dev/n
required property int index required property int index
text: String(modelData).charAt(0).toUpperCase() + String(modelData).slice(1) text: String(modelData).charAt(0).toUpperCase() + String(modelData).slice(1)
foreground: root.bar.foreground foreground: root.bar.foreground
tooltipBackground: root.bar.background
tooltipForeground: root.bar.foreground
fontFamily: root.bar.fontFamily fontFamily: root.bar.fontFamily
horizontalPadding: Style.spacing.controlPaddingX horizontalPadding: Style.spacing.controlPaddingX
verticalPadding: Style.spacing.controlPaddingY verticalPadding: Style.spacing.controlPaddingY
@@ -1088,7 +1088,6 @@ Item {
iconText: "󰄬" iconText: "󰄬"
tooltipText: "Confirm (default flavor)" tooltipText: "Confirm (default flavor)"
foreground: root.foreground foreground: root.foreground
panelBackground: root.background
fontFamily: root.fontFamily fontFamily: root.fontFamily
hasCursor: root.focusSection === "panel-action-button" && root.selectedIndex === 0 hasCursor: root.focusSection === "panel-action-button" && root.selectedIndex === 0
onHovered: function(h) { onHovered: function(h) {
@@ -1102,7 +1101,6 @@ Item {
tooltipText: "Forget network (urgent flavor)" tooltipText: "Forget network (urgent flavor)"
foreground: root.foreground foreground: root.foreground
hoverColor: root.urgent hoverColor: root.urgent
panelBackground: root.background
fontFamily: root.fontFamily fontFamily: root.fontFamily
hasCursor: root.focusSection === "panel-action-button" && root.selectedIndex === 1 hasCursor: root.focusSection === "panel-action-button" && root.selectedIndex === 1
onHovered: function(h) { onHovered: function(h) {
@@ -1115,7 +1113,6 @@ Item {
iconText: "󰄬" iconText: "󰄬"
tooltipText: "Disabled — type a passphrase first" tooltipText: "Disabled — type a passphrase first"
foreground: root.foreground foreground: root.foreground
panelBackground: root.background
fontFamily: root.fontFamily fontFamily: root.fontFamily
enabled: false enabled: false
hasCursor: root.focusSection === "panel-action-button" && root.selectedIndex === 2 hasCursor: root.focusSection === "panel-action-button" && root.selectedIndex === 2
@@ -1129,7 +1126,6 @@ Item {
iconText: "󰒓" iconText: "󰒓"
tooltipText: "Focusable (settings form button)" tooltipText: "Focusable (settings form button)"
foreground: root.foreground foreground: root.foreground
panelBackground: root.background
fontFamily: root.fontFamily fontFamily: root.fontFamily
fontSize: Style.font.subtitle fontSize: Style.font.subtitle
size: Style.space(26) size: Style.space(26)
@@ -1203,7 +1199,6 @@ Item {
visible: tipMouse.containsMouse || tipSwatch.focused visible: tipMouse.containsMouse || tipSwatch.focused
text: "Styled tooltip — drop into any panel" text: "Styled tooltip — drop into any panel"
panelForeground: root.foreground panelForeground: root.foreground
panelBackground: root.background
fontFamily: root.fontFamily fontFamily: root.fontFamily
} }
} }
@@ -1700,7 +1695,6 @@ Item {
tooltipText: "Forget network" tooltipText: "Forget network"
foreground: root.foreground foreground: root.foreground
hoverColor: root.urgent hoverColor: root.urgent
panelBackground: root.background
fontFamily: root.fontFamily fontFamily: root.fontFamily
} }
-4
View File
@@ -1072,7 +1072,6 @@ Item {
iconText: "󰁝" iconText: "󰁝"
tooltipText: "Move up" tooltipText: "Move up"
foreground: root.foreground foreground: root.foreground
panelBackground: root.background
fontFamily: root.fontFamily fontFamily: root.fontFamily
fontSize: Style.font.subtitle fontSize: Style.font.subtitle
size: Style.space(26) size: Style.space(26)
@@ -1086,7 +1085,6 @@ Item {
iconText: "󰁅" iconText: "󰁅"
tooltipText: "Move down" tooltipText: "Move down"
foreground: root.foreground foreground: root.foreground
panelBackground: root.background
fontFamily: root.fontFamily fontFamily: root.fontFamily
fontSize: Style.font.subtitle fontSize: Style.font.subtitle
size: Style.space(26) size: Style.space(26)
@@ -1100,7 +1098,6 @@ Item {
iconText: "󰒓" iconText: "󰒓"
tooltipText: "Settings" tooltipText: "Settings"
foreground: root.foreground foreground: root.foreground
panelBackground: root.background
fontFamily: root.fontFamily fontFamily: root.fontFamily
fontSize: Style.font.subtitle fontSize: Style.font.subtitle
size: Style.space(26) size: Style.space(26)
@@ -1117,7 +1114,6 @@ Item {
tooltipText: "Remove" tooltipText: "Remove"
foreground: root.urgent foreground: root.urgent
hoverColor: root.urgent hoverColor: root.urgent
panelBackground: root.background
fontFamily: root.fontFamily fontFamily: root.fontFamily
fontSize: Style.font.subtitle fontSize: Style.font.subtitle
size: Style.space(26) size: Style.space(26)