Opened 27 hours ago

Last modified 8 hours ago

#36851 assigned New feature

Add dark mode support for Django debug error pages

Reported by: Ekin Ertaç Owned by: Ekin Ertaç
Component: Error reporting Version: 6.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes

Description

Problem

When working in dark mode environments, Django's debug error pages (500, 404, etc.) display with bright white backgrounds (#fff and #eee), which causes significant eye strain and discomfort. This is a common issue for developers who work in dark mode, as the sudden bright white page can be jarring and painful to look at.

Django's admin interface and the main Django website already support dark mode, but the error pages do not, creating an inconsistent experience.

Proposed Solution

Add dark mode support to Django's debug error page templates using CSS media queries (@media (prefers-color-scheme: dark)). This would automatically detect the user's system preference and apply appropriate dark theme colors.

The affected templates are:

  • django/views/templates/technical_500.html
  • django/views/templates/technical_404.html

This should follow the same pattern used in Django admin for consistency.

Benefits

  • Reduces eye strain for developers working in dark mode
  • Creates consistency with Django admin and website dark mode support
  • Respects user's system preferences automatically
  • No breaking changes - light mode remains the default for systems without dark mode preference

Change History (7)

comment:1 by Kundan Yadav, 26 hours ago

Owner: set to Kundan Yadav
Status: newassigned

comment:2 by Ekin Ertaç, 26 hours ago

Hi @Kundan Yadav,

I've implemented dark mode support for Django's debug error pages as described in this ticket. The implementation includes:

Changes:

  • Added @media (prefers-color-scheme: dark) CSS to both technical_500.html and technical_404.html
  • Used a carefully chosen color palette for readability and consistency
  • All existing light mode functionality is preserved
  • Added comprehensive tests to verify dark mode CSS presence

Testing:

  • All tests pass (including 2 new dark mode tests)
  • Verified in both 500 and 404 error pages
  • No breaking changes

Pull Request:
Pull request created: https://github.com/django/django/pull/20506

The branch is ready for review. Let me know if you need any adjustments!

Last edited 26 hours ago by Ekin Ertaç (previous) (diff)

comment:3 by Kundan Yadav, 26 hours ago

Owner: Kundan Yadav removed
Status: assignednew

comment:4 by Kundan Yadav, 26 hours ago

i am sorry i have deassigned myself , i should have read the description properly , i though the proposed solution was for someone else to implemement , i am really sorry again

comment:5 by Ekin Ertaç, 26 hours ago

Owner: set to Ekin Ertaç
Status: newassigned

comment:6 by Ekin Ertaç, 26 hours ago

Hi @Kundan Yadav,

No worries at all. I understand the confusion. I've now claimed the ticket and will continue working on it. The implementation is complete with tests, and the PR is ready for review.

Thanks for your consideration, and I appreciate your message.

comment:7 by Ekin Ertaç, 8 hours ago

Has patch: set
Note: See TracTickets for help on using tickets.
Back to Top