Skip to content

Commit 98ba4a9

Browse files
committed
Bring on gradient borders
1 parent 30bafe7 commit 98ba4a9

48 files changed

Lines changed: 1323 additions & 328 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎bin/omarchy-theme-set-templates‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,25 @@ gradient_start_value() {
173173
fi
174174
}
175175

176+
shell_gradient_value() {
177+
local spec index
178+
179+
spec=$(resolve_theme_ref "$1" "${2:-}")
180+
parse_gradient "$spec"
181+
182+
if (( ${#GRADIENT_COLORS[@]} == 0 )); then
183+
printf "%s" "$spec"
184+
return
185+
fi
186+
187+
for index in "${!GRADIENT_COLORS[@]}"; do
188+
(( index > 0 )) && printf " "
189+
printf "%s" "${GRADIENT_COLORS[$index]}"
190+
done
191+
192+
[[ -n $GRADIENT_ANGLE ]] && printf " %sdeg" "$GRADIENT_ANGLE"
193+
}
194+
176195
add_template_value() {
177196
local key="$1"
178197
local value="$2"
@@ -247,6 +266,9 @@ add_gradient_function_value() {
247266
gradient_start)
248267
value=$(gradient_start_value "$key" "$fallback")
249268
;;
269+
shell_gradient)
270+
value=$(shell_gradient_value "$key" "$fallback")
271+
;;
250272
*)
251273
return
252274
;;
@@ -264,7 +286,7 @@ add_gradient_function_values() {
264286
[[ -n ${seen[$token]:-} ]] && continue
265287
seen[$token]=1
266288
add_gradient_function_value "$token"
267-
done < <(grep -hEo '\{\{[[:space:]]*(hypr_gradient|gradient_start)[[:space:]]+[^}]+[[:space:]]*\}\}' "$tpl" 2>/dev/null || true)
289+
done < <(grep -hEo '\{\{[[:space:]]*(hypr_gradient|gradient_start|shell_gradient)[[:space:]]+[^}]+[[:space:]]*\}\}' "$tpl" 2>/dev/null || true)
268290
done
269291
}
270292

‎default/themed/shell.toml.tpl‎

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Omarchy shell surfaces. Colors derive from colors.toml; sizes and the
22
# typographic scale come from the keys below. Themes can ship
3-
# themes/<name>/shell.toml to override any individual key.
3+
# themes/<name>/shell.toml to replace this generated file.
44

55
[bar]
66
# Alpha companions (where present) range from 0 (invisible) to 1 (opaque).
@@ -20,15 +20,20 @@ size-vertical = 28
2020
# Shared state tokens for interactive control chrome (buttons, dropdowns,
2121
# tab strips, etc).
2222

23-
# Normal: idle control chrome.
23+
# Normal: idle control chrome. Border widths accept one CSS-style scalar/list:
24+
# N, "Y X", "T X B", or "T R B L". Per-side keys like
25+
# normal-border-width-left override the list. Each *-border accepts either a
26+
# solid color or a Hyprland-style gradient, e.g. "rgba(...) rgba(...) 45deg".
2427
normal-color = "{{ foreground }}"
2528
normal-fill-alpha = 0.04
29+
normal-border = "{{ foreground }}"
2630
normal-border-width = 1
2731
normal-border-alpha = 0.4
2832

2933
# Hover-cursor: mouse hover and the panel keyboard cursor.
3034
hover-cursor-color = "{{ foreground }}"
3135
hover-cursor-fill-alpha = 0.08
36+
hover-cursor-border = "{{ foreground }}"
3237
hover-cursor-border-width = 1
3338
hover-cursor-border-alpha = 0.25
3439

@@ -37,12 +42,14 @@ hover-cursor-border-alpha = 0.25
3742
# — themes that want focus to stand out override these four lines.
3843
focus-color = "{{ foreground }}"
3944
focus-fill-alpha = 0.08
45+
focus-border = "{{ foreground }}"
4046
focus-border-width = 1
4147
focus-border-alpha = 0.25
4248

4349
# Selected: persistent chosen/current state.
4450
selected-color = "{{ foreground }}"
4551
selected-fill-alpha = 0.18
52+
selected-border = "{{ foreground }}"
4653
selected-border-width = 0
4754
selected-border-alpha = 1.0
4855

@@ -107,30 +114,34 @@ base-size = 12
107114

108115
[popups]
109116
# Shared by every bar flyout (dropdowns, OSD, popup cards).
117+
# Border accepts either a solid color or a Hyprland-style gradient. Border
118+
# widths accept one CSS-style scalar/list: N, "Y X", "T X B", or "T R B L";
119+
# individual border-width-top/right/bottom/left keys override the list.
110120
background = "{{ background }}"
111121
background-alpha = 1.0
112122
text = "{{ foreground }}"
113-
border = "{{ accent }}"
123+
border = "{{ shell_gradient hyprland_active_border accent }}"
114124
border-alpha = 1.0
125+
# border-width = 2
115126

116127
[tooltip]
117128
# Hover tooltips across the bar, panels, and buttons. background-alpha of
118129
# 0.97 mirrors the legacy hard-coded tooltip opacity.
119130
background = "{{ background }}"
120131
background-alpha = 0.97
121132
text = "{{ foreground }}"
122-
border = "{{ foreground }}"
133+
border = "{{ shell_gradient hyprland_active_border foreground }}"
123134
border-alpha = 1.0
124135

125136
[notifications]
126137
background = "{{ background }}"
127138
background-alpha = 1.0
128139
text = "{{ foreground }}"
129-
# Conventionally matches the Hyprland active-window border. If a theme
130-
# defines a gradient active border, the shell uses its first stop because
131-
# QML Rectangle borders are flat colors.
132-
border = "{{ gradient_start hyprland_active_border accent }}"
140+
# Conventionally matches the Hyprland active-window border. Border accepts
141+
# either a solid color or the full active-border gradient.
142+
border = "{{ shell_gradient hyprland_active_border accent }}"
133143
border-alpha = 1.0
144+
# border-width = 2
134145
countdown = "{{ accent }}"
135146

136147
[launcher]
@@ -141,14 +152,14 @@ countdown = "{{ accent }}"
141152
background = "{{ background }}"
142153
background-alpha = 0.95
143154
text = "{{ foreground }}"
144-
border = "{{ foreground }}"
155+
border = "{{ shell_gradient hyprland_active_border foreground }}"
145156
border-alpha = 1.0
146157
scrim = "{{ background }}"
147158
scrim-alpha = 0.5
148159
selected-background = "{{ foreground }}"
149160
selected-background-alpha = 0.08
150161
selected-text = "{{ accent }}"
151-
selected-border = "{{ foreground }}"
162+
selected-border = "{{ shell_gradient hyprland_active_border foreground }}"
152163
selected-border-alpha = 0.25
153164

154165
[menu]
@@ -158,14 +169,14 @@ selected-border-alpha = 0.25
158169
background = "{{ background }}"
159170
background-alpha = 1.0
160171
text = "{{ foreground }}"
161-
border = "{{ foreground }}"
172+
border = "{{ shell_gradient hyprland_active_border foreground }}"
162173
border-alpha = 1.0
163174
scrim = "{{ background }}"
164175
scrim-alpha = 0.5
165176
selected-background = "{{ foreground }}"
166177
selected-background-alpha = 0.08
167178
selected-text = "{{ accent }}"
168-
selected-border = "{{ foreground }}"
179+
selected-border = "{{ shell_gradient hyprland_active_border foreground }}"
169180
selected-border-alpha = 0.25
170181

171182
[polkit]
@@ -178,7 +189,7 @@ background = "{{ background }}"
178189
background-alpha = 1.0
179190
text = "{{ foreground }}"
180191
text-error = "{{ color1 }}"
181-
border = "{{ accent }}"
192+
border = "{{ shell_gradient hyprland_active_border accent }}"
182193
border-error = "{{ color1 }}"
183194
border-alpha = 1.0
184195
scrim = "{{ background }}"
@@ -196,8 +207,8 @@ background = "{{ background }}"
196207
background-alpha = 0.8
197208
text = "{{ foreground }}"
198209
text-error = "{{ color1 }}"
199-
border = "{{ foreground }}"
200-
border-active = "{{ accent }}"
210+
border = "{{ shell_gradient hyprland_active_border foreground }}"
211+
border-active = "{{ shell_gradient hyprland_active_border accent }}"
201212
border-error = "{{ color1 }}"
202213
border-alpha = 1.0
203214
# selection is the text-selection tint inside the input field.

‎docs/omarchy-shell.md‎

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,13 @@ customizes, `shell.json` is canonical — there is no deep-merge.
126126

127127
## Theme tokens
128128

129+
See [`theming.md`](theming.md) for the full theme/template workflow,
130+
including generated `*.tpl` files, gradient helpers, and shell border syntax.
131+
129132
Themes ship colors in `themes/<name>/colors.toml` and surface roles +
130133
sizing in `themes/<name>/shell.toml`. Defaults are generated from
131134
`default/themed/shell.toml.tpl`; a theme may also drop a hand-written
132-
`shell.toml` next to its `colors.toml` to override individual keys.
135+
`shell.toml` next to its `colors.toml` to replace the generated file.
133136

134137
The shell exposes these tokens to QML via two singletons in
135138
`qs.Commons`:
@@ -143,29 +146,34 @@ The shell exposes these tokens to QML via two singletons in
143146
state tokens/helpers, spacing (`Style.spacing.*` / `Style.space(px)`),
144147
the type scale (`Style.font.*`), and bar dimensions
145148
(`Style.bar.sizeHorizontal` / `Style.bar.sizeVertical`).
149+
- `Border` — border-spec helpers for QML surfaces. Use with
150+
`BorderSurface` from `qs.Ui` when a border should honor shell theme
151+
gradients or per-side widths. `Color.<section>.border` is only the
152+
flat-color fallback for code that cannot render a real border.
146153

147154
### Interactive states
148155

149156
`[controls]` standardizes reusable control chrome (buttons, dropdowns,
150157
tab strips, etc.) around four states: `normal`, `hover-cursor`, `focus`,
151-
and `selected`. State colors accept palette roles (`foreground`,
152-
`accent`, `urgent`, `background`) or hex strings; the default template
153-
ships hex values. Fill/border alphas are applied to that state's color.
158+
and `selected`. State colors and border tokens accept palette roles
159+
(`foreground`, `accent`, `urgent`, `background`) or hex strings; border
160+
values may also be gradients. Fill alpha applies to the state color;
161+
border alpha applies to the state's border token.
154162

155163
Surfaces like `[menu]`, `[launcher]`, and `[image-picker]` define
156164
their own `selected-*` tokens and do **not** inherit from `[controls]`.
157165
`[controls]` only governs the shared button/dropdown chrome.
158166

159-
| State | Color token | Fill alpha | Border width | Border alpha |
160-
|-------|-------------|------------|--------------|--------------|
161-
| Normal idle chrome | `normal-color` | `normal-fill-alpha` | `normal-border-width` | `normal-border-alpha` |
162-
| Hover / keyboard cursor | `hover-cursor-color` | `hover-cursor-fill-alpha` | `hover-cursor-border-width` | `hover-cursor-border-alpha` |
163-
| Qt activeFocus | `focus-color` | `focus-fill-alpha` | `focus-border-width` | `focus-border-alpha` |
164-
| Persistent selected/current | `selected-color` | `selected-fill-alpha` | `selected-border-width` | `selected-border-alpha` |
167+
| State | Color token | Fill alpha | Border token | Border width | Border alpha |
168+
|-------|-------------|------------|--------------|--------------|--------------|
169+
| Normal idle chrome | `normal-color` | `normal-fill-alpha` | `normal-border` | `normal-border-width` | `normal-border-alpha` |
170+
| Hover / keyboard cursor | `hover-cursor-color` | `hover-cursor-fill-alpha` | `hover-cursor-border` | `hover-cursor-border-width` | `hover-cursor-border-alpha` |
171+
| Qt activeFocus | `focus-color` | `focus-fill-alpha` | `focus-border` | `focus-border-width` | `focus-border-alpha` |
172+
| Persistent selected/current | `selected-color` | `selected-fill-alpha` | `selected-border` | `selected-border-width` | `selected-border-alpha` |
165173

166174
The template ships `focus-*` adjacent to `hover-cursor-*` with the same
167175
values so mouse hover, keyboard cursor, and tab focus read identically.
168-
Themes that want focus to stand out override the four `focus-*` keys.
176+
Themes that want focus to stand out override the `focus-*` keys.
169177

170178
Border widths are the theme-level on/off switches for state borders; set
171179
a width to `0` to keep the fill while removing that state border. The
@@ -178,6 +186,7 @@ default keeps selected borders off globally (`selected-border-width =
178186
hover-cursor-color = "accent"
179187
focus-color = "accent"
180188
selected-color = "foreground"
189+
focus-border = "rgba(33ccffee) rgba(00ff99ee) 45deg"
181190

182191
# Keep selected fills but remove selected-state borders.
183192
selected-border-width = 0

0 commit comments

Comments
 (0)