Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change hardcoded css colors to utilize css vars #125

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

silentbugs
Copy link

The chosen variables are the ones that django uses for each of those elements, and ideally can also be omitted entirely in a future commit.

This helps integrate django-nested-inline with django admin's new dark theme, as well as custom themes that are written around django admin's css vars.

@daniel-brenot
Copy link
Collaborator

Can you make sure this will also work for older django versions? I like the use of css vars and this will end up being quite useful in my use case as well, but i'm worried about compatability with older django versions that don't define values for those variables.

@silentbugs
Copy link
Author

I can't think of a neat way to have this work for versions that don't define css variables, other than maintaining two copies of the CSS files and serving whichever one suits the django version that the project is running, similar to js loading:

admin.py

css = {
    "all": ('admin/css/forms-nested%s.css' % ('' if VERSION < (3,2) else 'vars'),)
}

This however causes an issue with having to maintain both versions of the css file.

Can you think of a more elegant solution?

@silentbugs silentbugs force-pushed the admin_theme_colors branch from db43b2b to 05a9a37 Compare June 14, 2023 19:29
@cosmofactory
Copy link

Guys, these changes are great, exactly what I'm looking for. Merge would be nice.

the chosen variables are the ones that django uses for each of those elements, and ideally can also be omitted entirely in a future commit
@silentbugs
Copy link
Author

@daniel-brenot Since there hasn't come up a more elegant way of doing this, I've decided to add a second version of the old CSS file with the colors defined. Please review this with older versions of django as well.

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.

3 participants