diff --git a/content_editor/admin.py b/content_editor/admin.py index 3b2d180a..0f5d3442 100644 --- a/content_editor/admin.py +++ b/content_editor/admin.py @@ -113,6 +113,15 @@ def create(cls, model, **kwargs): ) +def auto_icon_colors(content_editor): + hue = 330 + for inline in content_editor.inlines: + if issubclass(inline, ContentEditorInline) and not inline.color: + inline.color = f"oklch(0.5 0.2 {hue})" + hue -= 20 + return content_editor + + class ContentEditor(ModelAdmin): """ The ``ContentEditor`` is a drop-in replacement for ``ModelAdmin`` with the @@ -139,6 +148,7 @@ def _content_editor_context(self, request, context): plugins = [] adding_not_allowed = ["_adding_not_allowed"] + for iaf in context.get("inline_admin_formsets", []): if not isinstance(iaf.opts, ContentEditorInline): continue