Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

548
Visualizações
Disable prefers-color-scheme: dark in django admin

I have dark mode enabled on Mac, but it looks awkward in django admin panel with ckeditor. Is it any option to disable it in Chrome or Django admin? I have already tried themes and browser extensions with no success.

enter image description here

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

It looks like you're using some 3rd party theme for Django admin. I suggest checking if the maintainer of this theme wants to support Django 3.2 any time soon.

As for the quick fix for that, you can introduce your own stylesheet that will reset variables responsible for the dark theme. You can find the variables here.

To achieve that, create a separate css file in your static file directory, copy over the @media declaration from the code fragment mentioned above and paste the normal color scheme inside it (also to be found in the same code fragment). After that, create a admin/base_site.html template, fill it with this content or the equivalent from the theme you're using and link your custom CSS in the extrastyle block (you may need to create that block by hand).

over 4 years ago · Santiago Trujillo Relatório

0

There's an app for that.

pip install django-light, details at https://github.com/frnhr/django-light.

Full disclosure: I'm the author. Well, more like "packager", not much original code there...

over 4 years ago · Santiago Trujillo Relatório

0

as @GwynBleidD wrote, I changed my admin/base_site.html like this, and it works:

{% extends "admin/base_site.html" %}

{% block extrastyle %}
<style>
    @media (prefers-color-scheme: dark) { 
        :root {
            --primary: #79aec8;
            --primary-fg: #fff;

            --body-fg: #333;
            --body-bg: #fff;
            --body-quiet-color: #666;
            --body-loud-color: #000;

            --breadcrumbs-fg: #c4dce8;
            --breadcrumbs-bg: var(--primary);

            --link-fg: #447e9b;
            --link-hover-color: #036;
            --link-selected-fg: #5b80b2;

            --hairline-color: #e8e8e8;
            --border-color: #ccc;

            --error-fg: #ba2121;

            --message-success-bg: #dfd;
            --message-warning-bg: #ffc;
            --message-error-bg: #ffefef;

            --darkened-bg: #f8f8f8; /* A bit darker than --body-bg */
            --selected-bg: #e4e4e4; /* E.g. selected table cells */
            --selected-row: #ffc;

            --close-button-bg: #888; /* Previously #bbb, contrast 1.92 */
            --close-button-hover-bg: #747474;
        }
    }
</style>
{% endblock %}
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda