fix: keep admin theme contrast consistent
CI / test (pull_request) Canceled after 34s
PR合并自动部署 / release-check (pull_request) Successful in 1m35s
PR合并自动部署 / deploy (pull_request) Successful in 10s

This commit is contained in:
2026-08-09 00:34:31 +08:00
parent ce07f6b3b7
commit c365454395
2 changed files with 89 additions and 0 deletions
+14
View File
@@ -20,3 +20,17 @@ def test_app_css_答题提交按钮可见且长弹窗可滚动():
assert "background: var(--green); color: white; text-align: center" in source
assert "max-height: calc(100dvh - 30px)" in source
assert "overflow-y: auto" in source
def test_admin_css_深色系统下仍保持完整浅色主题():
source = (STATIC_ROOT / "admin" / "css" / "hulumath_admin.css").read_text(
encoding="utf-8"
)
assert "color-scheme: light" in source
assert "--body-fg: #17211b" in source
assert "--body-bg: #f3f1e9" in source
assert "--darkened-bg: #ebeae3" in source
assert "background-color: #ffffff !important" in source
assert ".theme-toggle" in source
assert "display: none" in source
@@ -1,4 +1,5 @@
:root {
color-scheme: light;
--hulu-ink: #17211b;
--hulu-green: #196548;
--hulu-green-dark: #124d37;
@@ -8,18 +9,44 @@
--hulu-line: #dfe2da;
--hulu-muted: #6b756e;
--primary: #196548;
--primary-fg: #ffffff;
--secondary: #17211b;
--accent: #cce85b;
--body-fg: #17211b;
--body-bg: #f3f1e9;
--body-quiet-color: #6b756e;
--body-loud-color: #0d1510;
--header-bg: #17211b;
--header-color: #ffffff;
--header-branding-color: #ffffff;
--header-link-color: #ffffff;
--breadcrumbs-fg: #f3f1e9;
--breadcrumbs-bg: #235f47;
--breadcrumbs-link-fg: #f3f1e9;
--link-fg: #196548;
--link-hover-color: #124d37;
--link-selected-fg: #124d37;
--hairline-color: #e4e6df;
--border-color: #ccd2ca;
--error-fg: #b84136;
--message-success-bg: #dcefe5;
--message-warning-bg: #fff1c7;
--message-error-bg: #f8deda;
--darkened-bg: #ebeae3;
--selected-bg: #e2e9e2;
--selected-row: #dce9df;
--button-fg: #ffffff;
--button-bg: #196548;
--button-hover-bg: #124d37;
--default-button-bg: #17211b;
--default-button-hover-bg: #2c3931;
--close-button-bg: #667169;
--close-button-hover-bg: #3e4942;
--delete-button-bg: #b84136;
--delete-button-hover-bg: #913128;
--object-tools-fg: #ffffff;
--object-tools-bg: #196548;
--object-tools-hover-bg: #124d37;
}
body {
@@ -27,6 +54,10 @@ body {
color: var(--hulu-ink);
}
.theme-toggle {
display: none;
}
#header {
min-height: 70px;
padding: 0 28px;
@@ -125,6 +156,19 @@ div.breadcrumbs {
background: #ebeae3;
}
#nav-sidebar .module,
#nav-sidebar .module table,
#nav-sidebar .module th,
#nav-sidebar .module td {
background: var(--hulu-panel);
color: var(--hulu-ink);
}
#nav-sidebar .module td,
#nav-sidebar .module th {
border-color: var(--hulu-line);
}
#nav-sidebar .current-app .section,
#nav-sidebar .current-model {
background: rgba(25, 101, 72, .1);
@@ -164,6 +208,14 @@ select,
border-radius: 8px !important;
}
input:not([type=submit]):not([type=button]):not([type=checkbox]):not([type=radio]),
textarea,
select,
.vTextField {
background-color: #ffffff !important;
color: var(--hulu-ink) !important;
}
input:focus,
textarea:focus,
select:focus {
@@ -172,6 +224,29 @@ select:focus {
outline: none;
}
.form-row,
.submit-row {
border-color: var(--hulu-line);
background: var(--hulu-panel);
}
.form-row label,
.form-row p,
.form-row .help,
.form-row div.help,
.form-row div.help li {
color: var(--hulu-muted);
}
.form-row label {
color: #334039;
font-weight: 600;
}
.submit-row {
border: 1px solid var(--hulu-line);
}
.button,
input[type=submit],
input[type=button],