css: route palette + body typography through hive-fr0nt::BASE_CSS

This commit is contained in:
müde 2026-05-17 11:47:45 +02:00
parent 7fc3e81062
commit e283e39949
7 changed files with 28 additions and 43 deletions

6
Cargo.lock generated
View file

@ -451,6 +451,7 @@ dependencies = [
"anyhow", "anyhow",
"axum", "axum",
"clap", "clap",
"hive-fr0nt",
"hive-sh4re", "hive-sh4re",
"rmcp", "rmcp",
"rusqlite", "rusqlite",
@ -470,6 +471,7 @@ dependencies = [
"anyhow", "anyhow",
"axum", "axum",
"clap", "clap",
"hive-fr0nt",
"hive-sh4re", "hive-sh4re",
"libc", "libc",
"rusqlite", "rusqlite",
@ -481,6 +483,10 @@ dependencies = [
"tracing-subscriber", "tracing-subscriber",
] ]
[[package]]
name = "hive-fr0nt"
version = "0.1.0"
[[package]] [[package]]
name = "hive-sh4re" name = "hive-sh4re"
version = "0.1.0" version = "0.1.0"

View file

@ -10,6 +10,7 @@ workspace = true
anyhow.workspace = true anyhow.workspace = true
axum.workspace = true axum.workspace = true
clap.workspace = true clap.workspace = true
hive-fr0nt.workspace = true
hive-sh4re.workspace = true hive-sh4re.workspace = true
rmcp.workspace = true rmcp.workspace = true
rusqlite.workspace = true rusqlite.workspace = true

View file

@ -1,24 +1,9 @@
:root { /* Palette + base body typography live in hive-fr0nt::BASE_CSS, prepended
/* Catppuccin Mocha — mirrors the dashboard palette. */ to this stylesheet by `serve_css` at runtime. */
--bg: #1e1e2e; /* base */
--bg-elev: #181825; /* mantle */
--fg: #cdd6f4; /* text */
--muted: #7f849c; /* overlay1 */
--purple: #cba6f7; /* mauve */
--purple-dim: #45475a; /* surface1 */
--cyan: #89dceb; /* sky */
--amber: #fab387; /* peach */
--green: #a6e3a1; /* green */
--red: #f38ba8; /* red */
}
body { body {
background: var(--bg);
color: var(--fg);
font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", "Source Code Pro", monospace;
max-width: 110em; max-width: 110em;
margin: 1.5em auto; margin: 1.5em auto;
padding: 0 1.5em; padding: 0 1.5em;
line-height: 1.6;
} }
.banner { .banner {
text-align: center; text-align: center;

View file

@ -162,10 +162,15 @@ async fn serve_index() -> impl IntoResponse {
} }
async fn serve_css() -> impl IntoResponse { async fn serve_css() -> impl IntoResponse {
( // Prepend the shared palette/typography so per-page styles only need
[("content-type", "text/css")], // to declare what's actually page-specific. One HTTP request, no
// per-asset cache to invalidate.
let body = format!(
"{}\n{}",
hive_fr0nt::BASE_CSS,
include_str!("../assets/agent.css"), include_str!("../assets/agent.css"),
) );
([("content-type", "text/css")], body)
} }
async fn serve_app_js() -> impl IntoResponse { async fn serve_app_js() -> impl IntoResponse {

View file

@ -10,6 +10,7 @@ workspace = true
anyhow.workspace = true anyhow.workspace = true
axum.workspace = true axum.workspace = true
clap.workspace = true clap.workspace = true
hive-fr0nt.workspace = true
hive-sh4re.workspace = true hive-sh4re.workspace = true
libc = "0.2" libc = "0.2"
rusqlite.workspace = true rusqlite.workspace = true

View file

@ -1,27 +1,9 @@
:root { /* Palette + base body typography live in hive-fr0nt::BASE_CSS, prepended
/* Catppuccin Mocha. Keep the legacy variable names so per-class styles to this stylesheet by `serve_css` at runtime. */
don't need to be rewritten only the values change. */
--bg: #1e1e2e; /* base */
--bg-elev: #181825; /* mantle */
--fg: #cdd6f4; /* text */
--muted: #7f849c; /* overlay1 */
--purple: #cba6f7; /* mauve */
--purple-dim: #45475a; /* surface1 */
--cyan: #89dceb; /* sky */
--pink: #f5c2e7; /* pink */
--amber: #fab387; /* peach */
--green: #a6e3a1; /* green */
--red: #f38ba8; /* red */
--border: #313244; /* surface0 */
}
body { body {
background: var(--bg);
color: var(--fg);
font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", "Source Code Pro", monospace;
max-width: 70em; max-width: 70em;
margin: 1.5em auto; margin: 1.5em auto;
padding: 0 1.5em; padding: 0 1.5em;
line-height: 1.6;
} }
.banner { .banner {
text-align: center; text-align: center;

View file

@ -114,10 +114,15 @@ async fn serve_index() -> impl IntoResponse {
} }
async fn serve_css() -> impl IntoResponse { async fn serve_css() -> impl IntoResponse {
( // Prepend the shared palette/typography so per-page styles only need
[("content-type", "text/css")], // to declare what's actually page-specific. One HTTP request, no
// per-asset cache to invalidate.
let body = format!(
"{}\n{}",
hive_fr0nt::BASE_CSS,
include_str!("../assets/dashboard.css"), include_str!("../assets/dashboard.css"),
) );
([("content-type", "text/css")], body)
} }
async fn serve_app_js() -> impl IntoResponse { async fn serve_app_js() -> impl IntoResponse {