Gamerig Library: its own smooth gradient backdrop under the glass by default
CI / test (push) Successful in 7m13s

The desktop wallpaper's logo showing through the cards looked like a glitch. Background
now offers Gradient (default: 4 px bands with faint amber and blue glows), Wallpaper and Solid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hgvjzw8hHirxRsXSsE
This commit is contained in:
Claude committed 2026-11-26 03:29:54 +00:00
1 parent 02c831576a
commit 2960005139
4 files changed
+49 -7

No files matched your search

+37 -3
View File
@@ -50,8 +50,9 @@ pub(all) struct ConfigEntry {
///|
pub let colors_choices : Array[String] = ["Follow desktop", "Dark", "Light"]
///| Behind the library: the desktop's wallpaper through glassy panels, or gamerig's solid colour.
pub let background_choices : Array[String] = ["Wallpaper", "Solid"]
///| Behind the library: its own smooth gradient under glassy panels, the desktop's wallpaper
/// through those panels, or gamerig's solid colour.
pub let background_choices : Array[String] = ["Gradient", "Wallpaper", "Solid"]
///| Gamerig's colours.
pub(all) struct Pal {
@@ -158,7 +159,7 @@ pub fn Library::new() -> Library {
selected: "",
focused: false,
colors: "Follow desktop",
background: "Wallpaper",
background: "Gradient",
regions: [],
shown: [],
content_h: 0,
@@ -541,6 +542,37 @@ pub fn grid_fit(games : Array[Game], inner_w : Int, inner_h : Int) -> (Array[(In
last
}
///| The library's own backdrop: an even, gently lit gradient with no pattern or text in it, so
/// nothing behind the glassy cards reads as a glitch. Bands of 4 px and glows of many faint rings
/// keep each step below one colour level.
fn draw_gradient(ops : Array[@types.DrawOp], w : Int, h : Int, dark : Bool) -> Unit {
let (top, bottom) = if dark {
(c(31, 35, 54), c(13, 14, 21))
} else {
(c(236, 239, 247), c(205, 211, 228))
}
let band = 4
let n = (h + band - 1) / band
for i in 0..<n {
ops.push(@ui.fill_rect(@ui.rect(0, i * band, w, band), @ui.lerp_color(top, bottom, i, if n > 1 { n - 1 } else { 1 })))
}
// Two soft glows: gamerig's amber up right, a cool blue down left.
let glow = (cx : Int, cy : Int, r : Int, col : @types.Color, a : Int) => {
let rings = 24
for k in 0..<rings {
ops.push(@ui.circle(cx, cy, r - r * k / rings, @ui.with_alpha(col, a)))
}
}
let big = if w > h { w } else { h }
if dark {
glow(w * 4 / 5, h / 6, big * 2 / 5, c(246, 183, 46), 1)
glow(w / 6, h * 5 / 6, big * 2 / 5, c(80, 110, 220), 2)
} else {
glow(w * 4 / 5, h / 6, big * 2 / 5, c(246, 183, 46), 2)
glow(w / 6, h * 5 / 6, big * 2 / 5, c(120, 150, 240), 2)
}
}
///| Draw the whole library for an output `size`.
pub fn Library::render(
self : Library,
@@ -559,6 +591,8 @@ pub fn Library::render(
let ops : Array[@types.DrawOp] = []
if self.background == "Solid" {
ops.push(@ui.fill_rect(@ui.rect(0, 0, w, h), p.bg))
} else if self.background == "Gradient" {
draw_gradient(ops, w, h, p.dark)
} else {
// A light veil under the top bar keeps its text readable on any wallpaper.
ops.push(@ui.fill_rect(@ui.rect(0, 0, w, top_h), @ui.with_alpha(p.panel, 120)))