Generally, django background is used, especially when there are colored fields, to avoid manually entering a large number of colors, you can use the h5 color tab, so that users can directly select the color they want through the tab. At this time, it can be customized through the background admin form.
from django.forms.widgets import TextInput class RelationTypeForm(ModelForm): class Meta: model = RelationType fields = '__all__' widgets = { 'relation_color': TextInput(attrs={'type': 'color'}), #type:color is a fixed value }