colours from the wallpaper through matugen

- matugen/amane.colors: a matugen template (primary, on_primary,
  primary_container, primary_fixed, on_surface, on_surface_variant,
  outline_variant, surface_container high/normal/lowest) that skwd-wall
  renders into ~/.config/amane/theme on every new wallpaper
- theme.rs: a Theme service reads that file and shell.conf twice a
  second (matugen replaces its output, which a file watch can lose) and
  fades all ten colours together on one Animation; without a theme file
  the shell keeps its pink on purple
- the island, the idle pill and the workspace pill draw with the theme;
  white overlays (chips, tracks, hover tints) stay as they are
- shell.conf: cover_colors (true: the open media card and equalizer take
  the cover's gradient as background, accents stay the wallpaper's) and
  transition_ms (0 switches instantly), both applied without a restart
- parse: settings() and rgb(), with a test (6 pass)
- checked on the desktop with a hand-written theme file: pill, workspace
  pill and card recolour, cover_colors switches the card background live
This commit is contained in:
server2
2026-10-09 04:28:39 +02:00
parent 2870ebbd13
commit eabda748f5
10 changed files with 348 additions and 83 deletions
+20 -16
View File
@@ -4,11 +4,12 @@ use std::thread;
use std::time::Duration;
use amane::{
Animation, Blend, Center, Color, Full, Horizontal, InputArea, Layer, LayerWindow, Monitor, Padding, Palette, Parent, Pointer,
Animation, Blend, Center, Color, Full, Horizontal, InputArea, Layer, LayerWindow, Monitor, Padding, Parent, Pointer,
Rectangle, Row, Service, Shadow, Start, Text, Vertical, Weight, Widget, Workspace, Workspaces, Zone,
};
use crate::island::{CHIP_HOVER, CLEAR, COMPACT_H, DIM, EDGE, HOVER_MS, INK, PINK, SHADOW, TEXT, TOP_GAP, backdrop, backdrop_colors, faded};
use crate::island::{CHIP_HOVER, CLEAR, COMPACT_H, HOVER_MS, SHADOW, TOP_GAP, backdrop, faded};
use crate::theme;
// one round slot per workspace, inside the pill's inset; the pill sits LEFT px from the monitor's edge
const SLOT: f32 = 28.0;
@@ -31,14 +32,15 @@ impl Service for Hover {
/*
* a pill in the top left corner of every monitor with that monitor's hyprland workspaces,
* in the island's look (cover gradient, pink glow). the focused workspace is pink, the one
* shown on another monitor a softer pink, empty ones dim; a click switches to it.
* in the wallpaper's colours like the island. the focused workspace takes the accent, the
* one shown on another monitor a softer accent, empty ones dim; a click switches to it.
* Workspaces follows hyprland's events, so nothing polls
*/
pub fn view(monitor: &Monitor) -> LayerWindow {
theme::begin();
let workspaces = Workspaces::read();
let hover = Hover::read();
let palette = Palette::read();
// special workspaces (scratchpads) aren't places to switch to
let here: Vec<&Workspace> = workspaces
@@ -78,14 +80,16 @@ pub fn view(monitor: &Monitor) -> LayerWindow {
_ => workspace.index().to_string(),
};
let (fill, color, weight) = if workspace.focused() {
(PINK, INK, Weight::Bold)
} else if workspace.active() {
(faded(PINK, 70), PINK, Weight::Bold)
} else {
let resting = if workspace.windows() > 0 { TEXT } else { DIM };
let theme = theme::now();
(Color::blend(CLEAR, CHIP_HOVER, lit), Color::blend(resting, TEXT, lit), Weight::Regular)
let (fill, color, weight) = if workspace.focused() {
(theme.accent, theme.on_accent, Weight::Bold)
} else if workspace.active() {
(faded(theme.accent, 70), theme.accent, Weight::Bold)
} else {
let resting = if workspace.windows() > 0 { theme.text } else { theme.dim };
(Color::blend(CLEAR, CHIP_HOVER, lit), Color::blend(resting, theme.text, lit), Weight::Regular)
};
slots.push(Box::new(
@@ -103,15 +107,15 @@ pub fn view(monitor: &Monitor) -> LayerWindow {
));
}
let colors = backdrop_colors(&palette);
let theme = theme::now();
let pill = Rectangle::new()
.width(width)
.height(COMPACT_H)
.radius(Full)
.fill(backdrop(&colors, 255))
.border(1.0, EDGE)
.shadow(Shadow::drop(PINK).opacity(0.3).blur(22.0))
.fill(backdrop(&theme.surfaces(), 255))
.border(1.0, theme.outline)
.shadow(Shadow::drop(theme.accent).opacity(0.3).blur(22.0))
.padding(INSET)
.align_child(Start, Center)
.child(Row::new(slots).gap(SLOT_GAP).align(Center));