Skip to content

fix: monitoring colors under themes, daisyUI light/dark, final v0.4.0.0 fixes - #20

Merged
tanhtm merged 8 commits into
main2.0from
feat/daisyui-multi-theme
Oct 14, 2026
Merged

tanhtm merged 8 commits into
main2.0from
feat/daisyui-multi-theme

Conversation

@tanhtm

@tanhtm tanhtm commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Second follow-up to #18. #19 was merged with its first two commits only (sidebar branding, changelist toolbar and pagination). This PR carries the rest of that work, the fixes from a final review, and release hardening before tagging v0.4.0.0.

Monitoring dashboard colors under daisyUI themes

  • Problem: the toolbar, selected time range, method badges, share bars and chart lines were hand-styled with Unfold's primary-600/500 and white text, so several themes were unreadable:
    • luxury: white text on a white primary;
    • black and business: accents nearly invisible on a near-black page;
    • cupcake: pale teal on white.
  • Controls now use daisyUI components, so they follow the active theme:
    • host and auto-refresh selects: ui-select;
    • time range: a ui-join of ui-btn, with ui-btn-primary on the selected one;
    • Live indicator: ui-badge-success;
    • banner: ui-alert;
    • endpoint methods: solid ui-badge info/warning/error;
    • share bars: ui-progress.
  • Matching Unfold's controls: unselected buttons and selects get a panel background and an input border through daisyUI's --ui-btn-bg/--ui-btn-border, like Unfold's own controls.
  • Contrast choices:
    • Solid badge variants are used because daisyUI only guarantees contrast for color/-content pairs. The soft badges vanished in black and bumblebee.
    • The soft alert keeps its tint but uses the theme's text color, because its yellow text was unreadable on light themes.
  • Lines and bars on the page (chart lines, share bars, toolbar icon) use --mon-accent, the theme primary mixed with the text color. dashboard.js resolves it through the DOM for Chart.js. If the browser can't compute it (no color-mix()), the old palette is used.
  • Accessibility:
    • the Live dot pulses only when motion is allowed, and is hidden server-side when auto refresh is off;
    • the status banner is rewritten only when its text changes, so screen readers don't re-read it every refresh;
    • share bars are aria-hidden;
    • the row-header focus ring falls back to currentColor.

daisyUI in the default light/dark modes

Plain dark is Unfold's palette, not a daisyUI theme. daisyUI kept its stock gray-slate base there, so its components showed as gray blocks on Unfold's navy background.

  • gen-themes.mjs now points daisyUI base-100/200/300 and base-content at UNFOLD["COLORS"] for light/dark, as it already did for primary. The other 33 themes are unchanged.

Admin fixes from the final review

  • Admin index: flash messages were rendered twice, because admin/base.html already has the messages block.
  • Pagination:
    • Previous/Next were stuck disabled when Django ignores ?all (more rows than list_max_show_all). The ?all check now also requires can_show_all.
    • The buttons moved to unfold/helpers/wn_page_button.html and get page passed explicitly, so a page variable in the changelist context can't leak in.
    • The soft primary buttons no longer change their text color on hover. Before this, the label turned the same color as the button.
  • Changelist toolbar: it renders only when one of its controls will show. Admins with only horizontal filters no longer get an empty row.
  • Admin index template extends admin/base_site.html instead of copying its branding block.

Release hardening

  • django-unfold>=0.109.0,<0.111: the package overrides about 15 Unfold templates, so an untested Unfold release could break the admin of every project that installs it. Raise the cap after re-testing; 0.110.0 is file-for-file identical to 0.109.0.
  • CI for pull requests (.github/workflows/ci.yml). The repo only had a publish workflow, so PRs had no checks. It runs:
    • check, makemigrations --check, msgfmt and the test suite;
    • a job that rebuilds the themes and Tailwind CSS and fails if daisy-themes.css, themes.py or styles.css differ from the committed files.
  • Reproducible Tailwind build:
    • The md2html_tailwind4 @source used a python3.* directory glob, which Tailwind doesn't expand. As a result, the classes the markdown preview emits (admonitions etc.) were never compiled; this predates v0.4.0.0: daisyUI themes, server monitoring dashboard, Unfold 0.109, security & performance #18. scripts/tailwind.sh now links the installed package to .tw-md2html, which is gitignored and removed after the build.
    • Markdown prose (docs/, *.md) is no longer scanned. Before this, words in the changelog added utilities, so editing release notes changed styles.css.

Release notes

CHANGELOG.md, README.md and docs/reports/releases/2026-10-13-v0.4.0.0.md now cover all of the above.

Validation

  • manage.py test whiteneuron: 42 tests pass in three setups:
    • the test project;
    • the package's own settings;
    • a clean venv with the built wheel, which resolves django-unfold 0.110.0.
  • New regression tests each fail without their fix:
    • flash message shown once;
    • Next disabled on the last full page;
    • ?all above list_max_show_all;
    • ?all honored;
    • Previous disabled on page 1.
  • Both CI jobs were run by hand in a fresh clone (uv sync --frozen, npm ci, scripts/tailwind.sh): the tests pass and the rebuilt CSS matches the committed files.
  • check is clean and makemigrations reports no changes. msgfmt --check passes and makemessages finds no untranslated Vietnamese strings.
  • uv build: the wheel contains the new templates, static files, .mo files and migrations.
  • Swept 101 admin URLs in a project configured like the README. All return 200 and render the site branding; views the user lacks permission for return 403.
  • Checked in Chromium:
    • the monitoring toolbar, banner and endpoints table under all 35 themes, including default light/dark and dark from the OS setting;
    • login, users grid, pagination (including hover) and the theme picker in light/dark;
    • reduced motion;
    • no JS errors.

After merge

Create a GitHub Release for tag v0.4.0.0 on main2.0; the publish workflow uploads it to PyPI. If the release is not dated 2026-10-13, update the date in the release notes.

The toolbar icon, selected time-range button, method badges, share bars
and chart lines used Unfold's primary-600/500 with white text. With
daisyUI themes that is unreadable: white text on luxury's white primary,
a near-invisible dark-gray (black) or dark-blue (business) icon on a
near-black page, a pale teal (cupcake) on white.

- Selected range: daisyUI --color-primary / --color-primary-content (the
  generator syncs them with Unfold's primary for plain light/dark).
- Text, icons, bars and chart lines: --mon-accent, the theme primary
  mixed with the text color so it contrasts with the page in every
  theme; dashboard.js resolves it through the DOM for Chart.js.
…onents

The controls were hand-styled with Unfold's palette; daisyUI components
pick up the active theme's colors (and contrast pairs) by themselves.

- Host / auto-refresh: ui-select; time range: ui-join of ui-btn with
  ui-btn-primary on the selected one; refresh: ui-btn-square.
- Live indicator: ui-badge-success; banner: ui-alert (soft tint, theme
  text color: the soft variant's yellow text was unreadable on light
  themes); endpoint methods: solid ui-badge info/warning/error (soft
  badges vanished in black/bumblebee); share bars: ui-progress-primary.
- Panels keep the Unfold card look and chart lines keep --mon-accent
  (Chart.js can't use classes).
- styles.css rebuilt (only adds the new rules).
- Pagination: ?all only disables Previous/Next when Django can show all
  rows (show_all and can_show_all); with more than list_max_show_all it
  keeps paginating and the buttons were stuck disabled. Buttons moved to
  wn_page_button.html; tests assert the button itself and the ?all case.
- Changelist toolbar: render only when a control will show (vertical
  filters, not any filter), so horizontal-only filters don't get an
  empty toolbar row.
- Admin index extends base_site.html instead of copying its branding.
- Monitoring: share bars use --mon-accent again (theme primary vanished
  on black/cupcake) and are aria-hidden (they showed a different number
  from the text); Live dot pulses only with motion allowed; the status
  banner is rewritten only when its text changes (screen readers re-read
  it every refresh); resolved() detects unusable colors by comparing
  with the inherited text color; removed the unused primaryDark /
  --mon-accent-strong and a redundant [hidden] rule.
In plain dark mode daisyUI kept its stock gray-slate base colors, so the
monitoring toolbar's buttons, selects and banner showed as gray blocks on
Unfold's navy background (the default dark is Unfold's palette, not a
daisyUI theme).

- gen-themes: the light/dark themes point daisyUI base-100/200/300 and
  base-content at UNFOLD["COLORS"] (resolved at runtime), as primary
  already did; other themes are unchanged.
- Monitoring toolbar: unselected buttons and selects drawn like Unfold's
  own controls (panel background + input border) via daisyUI's
  --ui-btn-bg/--ui-btn-border; the banner tint is raised so it reads on
  dark surfaces.
- styles.css / daisy-themes.css regenerated.
- Admin index: flash messages rendered twice (admin/base.html already has
  the messages block); test added.
- Pagination: one condition per button, page passed explicitly to the
  helper (a 'page' context variable could leak in), and no hover text
  color on the soft primary buttons (label turned the button's color);
  tests for ?all honored and for page 1.
- Monitoring: Live badge hidden server-side when auto refresh is off;
  row-header focus ring falls back to currentColor without color-mix();
  the two banner rules merged.
- CHANGELOG/README/release notes: post-#18 fixes, light/dark daisyUI
  colors following UNFOLD["COLORS"], validation (42 tests, wheel with
  django-unfold 0.110.0).
- django-unfold>=0.109.0,<0.111: the package overrides ~15 Unfold
  templates, so a new Unfold release is re-tested before the cap is
  raised (0.110.0 is identical to 0.109.0).
- .github/workflows/ci.yml: system check, makemigrations --check,
  msgfmt, the test suite, and a check that daisy-themes.css / themes.py /
  styles.css match a fresh Tailwind build.
- The md2html_tailwind4 @source used a python3.* directory glob, which
  Tailwind does not expand, so the classes its converter emits for
  markdown previews (admonitions etc.) were never compiled. tailwind.sh
  now links the installed package to .tw-md2html and styles.css scans
  that path.
- Markdown prose (docs/, *.md) is excluded from the scan: words in the
  changelog were adding utilities, so editing release notes changed
  styles.css.
- styles.css regenerated.
@tanhtm
tanhtm merged commit 3de63d4 into main2.0 Oct 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant