django-autocomplete-light icon indicating copy to clipboard operation
django-autocomplete-light copied to clipboard

Adding dark mode support

Open trumpet2012 opened this issue 3 years ago • 0 comments

This fixes #1245 where the select2 fields don't honor the Django dark mode theme.

The fix requires using the CSS variables defined by the Django admin. These variables get used for both dark mode and light mode. For older Django versions < 3.2 before these variables were added, a fallback value is provided that matches the default styling that select2 was using.

Below you can see the comparison between the different fields and their states before and after these changes are applied.

Dark Mode Comparison

List comparison

Multiple choice field

Empty/Inactive

Before

image

After

image

Empty and dropdown open

Before

image

After

image

1 selected

Before

image

After

image

1 selected and dropdown open

Before

image

After

image

1 selected and searching

Before

image

After

image

Single choice field

Empty/Inactive

Before

image

After

image

Empty and dropdown open

Before

image

After

image

Choice selected

Before

image

After

image

Choice selected and dropdown open

Before

image

After

image

1 selected and searching

Before

image

After

image

Table comparison

Field Type Field State Before After
Multiple Choice Empty/Inactive image image
Multiple Choice Empty and dropdown open image image
Multiple Choice 1 selected image image
Multiple Choice 1 selected and dropdown open image image
Multiple Choice 1 selected and searching image image
Single Choice Empty/Inactive image image
Single Choice Empty and dropdown open image image
Single Choice Choice selected image image
Single Choice Choice selected and dropdown open image image
Single Choice 1 selected and searching image image
Light Mode Comparison

List comparison

Multiple choice

Empty/Inactive

Before

image

After

image

Empty and dropdown open

Before

image

After

image

1 selected

Before

image

After

image

1 selected and dropdown open

Before

image

After

image

1 selected and searching

Before

image

After

image

Single choice

Empty/Inactive

Before

image

After

image

Empty and dropdown open

Before

image

After

image

Choice selected

Before

image

After

image

Choice selected and dropdown open

Before

image

After

image

Choice selected and searching

Before

image

After

image

Table view

Field Type Field State Before After
Multiple Choice Empty/Inactive image image
Multiple Choice Empty and dropdown open image image
Multiple Choice 1 selected image image
Multiple Choice 1 selected and dropdown open image image
Multiple Choice 1 selected and searching image image
Single Choice Empty/Inactive image image
Single Choice Empty and dropdown open image image
Single Choice Choice selected image image
Single Choice Choice selected and dropdown open image image
Single Choice 1 selected and searching image image

trumpet2012 avatar Sep 20 '22 21:09 trumpet2012