anvilsign in

collin/anvil · 9162f830

Fix dark mode on the settings pages

Collin Richards · 2026-08-18 11:16 UTC · 9162f8306f5434eec386c071f5e11f804f6cd109 · parent c4cfe9ad · browse files

modifiedcrates/anvil-web/src/auth.rs+1 −1
⋯ 238 unchanged lines
239239 html! {
240240 h1 { "Sign in" }
241241 @if let Some(error) = error {
242- p style="color:#cf222e" { (error) }
242+ p.error-msg { (error) }
243243 }
244244 form method="post" action="/-/login" style="max-width:320px" {
245245 p { label { "Username" br; input name="username" autofocus; } }
⋯ 38 unchanged lines
modifiedcrates/anvil-web/src/passkeys.rs+2 −2
⋯ 644 unchanged lines
645645
646646 function fail(message) {
647647 statusEl.textContent = message;
648- statusEl.style.color = '#cf222e';
648+ statusEl.style.color = 'var(--error)';
649649 button.disabled = false;
650650 }
651651
⋯ 46 unchanged lines
698698
699699 function fail(message) {
700700 statusEl.textContent = message;
701- statusEl.style.color = '#cf222e';
701+ statusEl.style.color = 'var(--error)';
702702 button.disabled = false;
703703 }
704704
⋯ 40 unchanged lines
modifiedcrates/anvil-web/src/secrets.rs+1 −1
⋯ 679 unchanged lines
680680
681681 function fail(message) {
682682 statusEl.textContent = message;
683- statusEl.style.color = '#cf222e';
683+ statusEl.style.color = 'var(--error)';
684684 button.disabled = false;
685685 }
686686
⋯ 35 unchanged lines
modifiedcrates/anvil-web/src/ui.rs+19 −15
⋯ 90 unchanged lines
9191 };
9292
9393 const STYLE: &str = r#"
94-:root { --fg:#1f2328; --muted:#656d76; --bg:#fff; --border:#d0d7de; --accent:#0969da; --code-bg:#f6f8fa; --success:#1a7f37; --success-bg:#dafbe1; --error:#cf222e; --error-bg:#ffebe9; --warning:#7d4e00; --warning-bg:#fff8c5; --info:#8250df; --info-bg:#fbefff; --dir-icon:#54aeff; --diff-ins-bg:#e6ffec; --diff-del-bg:#ffebe9; }
94+:root { color-scheme:light; --fg:#1f2328; --muted:#656d76; --bg:#fff; --border:#d0d7de; --accent:#0969da; --code-bg:#f6f8fa; --success:#1a7f37; --success-bg:#dafbe1; --error:#cf222e; --error-bg:#ffebe9; --warning:#7d4e00; --warning-bg:#fff8c5; --info:#8250df; --info-bg:#fbefff; --dir-icon:#54aeff; --diff-ins-bg:#e6ffec; --diff-del-bg:#ffebe9; }
9595 @media (prefers-color-scheme: dark) {
96- :root { --fg:#e6edf3; --muted:#8b949e; --bg:#0d1117; --border:#30363d; --accent:#58a6ff; --code-bg:#161b22; --success:#3fb950; --success-bg:#1a3a1a; --error:#f85149; --error-bg:#3d1f1a; --warning:#d29922; --warning-bg:#3a2a1a; --info:#a371f7; --info-bg:#2a1e4e; --dir-icon:#79c0ff; --diff-ins-bg:#0d2818; --diff-del-bg:#2d1519; }
96+ :root { color-scheme:dark; --fg:#e6edf3; --muted:#8b949e; --bg:#0d1117; --border:#30363d; --accent:#58a6ff; --code-bg:#161b22; --success:#3fb950; --success-bg:#1a3a1a; --error:#f85149; --error-bg:#3d1f1a; --warning:#d29922; --warning-bg:#3a2a1a; --info:#a371f7; --info-bg:#2a1e4e; --dir-icon:#79c0ff; --diff-ins-bg:#0d2818; --diff-del-bg:#2d1519; }
9797 }
9898 * { box-sizing:border-box; }
9999 body { margin:0; font:14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif; color:var(--fg); background:var(--bg); }
⋯ 5 unchanged lines
105105 main { padding:12px 0 24px; }
106106 h1,h2 { font-weight:600; } h1 { font-size:20px; } h2 { font-size:15px; margin:20px 0 8px; }
107107 .muted { color:var(--muted); }
108+.error-msg { color:var(--error); }
108109 .repo-list { list-style:none; padding:0; margin:0; }
109110 .repo-list li { padding:12px 0; border-bottom:1px solid var(--border); }
110111 .repo-list .name { font-size:16px; font-weight:600; }
111112 .box { border:1px solid var(--border); border-radius:6px; overflow:hidden; }
112-.box .row { display:flex; justify-content:space-between; padding:8px 16px; border-top:1px solid var(--border); }
113+.box .row { display:flex; gap:12px; justify-content:space-between; padding:8px 16px; border-top:1px solid var(--border); }
113114 .box .row:first-child { border-top:0; }
114115 .box .row a.entry { display:flex; gap:8px; align-items:center; white-space:nowrap; }
115116 .box .row a.fc-msg { flex:1; margin-left:24px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:left; color:var(--muted); font-size:13px; }
⋯ 54 unchanged lines
170171 .pill-group > .pill { border-radius:0; margin-left:-1px; position:relative; }
171172 .pill-group > .pill:first-child { border-radius:2em 0 0 2em; margin-left:0; }
172173 .pill-group > .pill:last-child { border-radius:0 2em 2em 0; }
173-form.stack p { margin:10px 0; } form.stack label { font-size:13px; color:var(--muted); }
174-form.stack input[type=text], form.stack textarea { width:100%; max-width:480px; padding:6px 8px; border:1px solid var(--border); border-radius:6px; font:inherit; }
175-form.stack .check { display:flex; gap:8px; align-items:flex-start; max-width:480px; }
176-form.stack select { padding:6px 8px; border:1px solid var(--border); border-radius:6px; font:inherit; }
177-form.stack textarea.editor { max-width:none; font:13px/1.5 ui-monospace,monospace; tab-size:4; resize:vertical; }
174+.stack p { margin:10px 0; } .stack label { font-size:13px; color:var(--muted); }
175+/* Explicit colours, not just borders: a control left to the browser's defaults
176+ renders white-on-white in dark mode. `color-scheme` above covers the rest. */
177+.stack input[type=text], .stack input[type=password], .stack textarea, .stack select { background:var(--bg); color:var(--fg); }
178+.stack input[type=text], .stack input[type=password], .stack textarea { width:100%; max-width:480px; padding:6px 8px; border:1px solid var(--border); border-radius:6px; font:inherit; }
179+.stack .check { display:flex; gap:8px; align-items:flex-start; max-width:480px; }
180+.stack select { padding:6px 8px; border:1px solid var(--border); border-radius:6px; font:inherit; }
181+.stack textarea.editor { max-width:none; font:13px/1.5 ui-monospace,monospace; tab-size:4; resize:vertical; }
178182 p.file-actions { margin:10px 0; display:flex; gap:6px; align-items:center; }
179183 .file-actions .btn { padding:3px 11px; font-size:12px; font-weight:500; border-radius:6px; display:inline-flex; align-items:center; gap:5px; }
180184 table.usage { border-collapse:collapse; width:100%; max-width:680px; margin-top:12px; }
⋯ 20 unchanged lines
201205 .kanban .card-del { position:absolute; top:3px; right:4px; margin:0; }
202206 .kanban .card-del-btn { border:0; background:none; color:var(--muted); cursor:pointer; font-size:16px; line-height:1; padding:1px 5px; border-radius:4px; opacity:0; transition:opacity .1s,background .1s; }
203207 .kanban .card:hover .card-del-btn, .card-del-btn:focus { opacity:1; }
204-.kanban .card-del-btn:hover { color:#cf222e; background:var(--code-bg); }
208+.kanban .card-del-btn:hover { color:var(--error); background:var(--code-bg); }
205209 .kanban .card .title { padding-right:14px; }
206210 .kanban .card:has(.card-grip) { padding-left:28px; }
207211 .kanban .card-grip { position:absolute; left:2px; top:5px; color:var(--muted); cursor:grab; touch-action:none; user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; line-height:0; padding:4px 5px; border-radius:4px; }
⋯ 636 unchanged lines
844848
845849 h2 { "SSH keys" }
846850 p.muted { "Add a public key to clone and push over SSH." }
847- @if let Some(error) = error { p style="color:#cf222e" { (error) } }
851+ @if let Some(error) = error { p.error-msg { (error) } }
848852 @if keys.is_empty() {
849853 p.muted { "No SSH keys yet." }
850854 } @else {
⋯ 174 unchanged lines
10251029 Some(user),
10261030 html! {
10271031 h1 { "New repository" }
1028- @if let Some(error) = error { p style="color:#cf222e" { (error) } }
1032+ @if let Some(error) = error { p.error-msg { (error) } }
10291033 form.stack method="post" action="/-/new" {
10301034 (csrf_input(csrf))
10311035 p { label { "Name" br; input type="text" name="name" value=(name) placeholder="my-project" autofocus; } }
⋯ 92 unchanged lines
11241128 user,
11251129 html! {
11261130 h1 { a href=(format!("/{owner}/{repo}")) { (owner) "/" (repo) } " · settings" }
1127- @if let Some(error) = error { p style="color:#cf222e" { (error) } }
1131+ @if let Some(error) = error { p.error-msg { (error) } }
11281132 form.stack method="post" action=(format!("/{owner}/{repo}/settings")) {
11291133 (csrf_input(csrf))
11301134 p { label { "Description" br; input type="text" name="description" value=(meta.description); } }
⋯ 501 unchanged lines
16321636 h1 { a href=(format!("/{owner}/{repo}")) { (owner) "/" (repo) } }
16331637 (breadcrumbs(owner, repo, rev, path, true))
16341638 p.muted { "Editing on branch " code { (rev) } " — commits as you." }
1635- @if let Some(error) = error { p style="color:#cf222e" { (error) } }
1639+ @if let Some(error) = error { p.error-msg { (error) } }
16361640 form.stack method="post" action=(action) {
16371641 (csrf_input(csrf))
16381642 input type="hidden" name="expected_tip" value=(expected_tip);
⋯ 369 unchanged lines
20082012 h1 { a href=(format!("/{owner}/{repo}")) { (owner) "/" (repo) } }
20092013 (breadcrumbs(owner, repo, rev, path, true))
20102014 h2 { "Add a task" }
2011- @if let Some(error) = error { p style="color:#cf222e" { (error) } }
2015+ @if let Some(error) = error { p.error-msg { (error) } }
20122016 form.stack method="post" action=(action) {
20132017 (csrf_input(csrf))
20142018 input type="hidden" name="expected_tip" value=(expected_tip);
⋯ 145 unchanged lines
21602164 };
21612165
21622166 let mut html = String::from(
2163- r#"<div class="language-bar" style="display:flex;border-radius:4px;overflow:hidden;height:20px;background:#f0f0f0;">"#,
2167+ r#"<div class="language-bar" style="display:flex;border-radius:4px;overflow:hidden;height:20px;background:var(--code-bg);">"#,
21642168 );
21652169 for lang_obj in langs {
21662170 if let (Some(lang), Some(percent)) = (
⋯ 690 unchanged lines