Package: django-colorfield
django-colorfieldsimple color field for your models with a nice color-picker in the admin-interface.InstallationRunpip install django-colorfieldAddcolorfieldtosettings.INSTALLED_APPSRunpython manage.py collectstaticRestart your application serverUsageSettingsThis package doesn't need any setting.ModelsJust add color field(s) to your models like this:fromcolorfield.fieldsimportColorFieldfromdjango.dbimportmodelsclassMyModel(models.Model):color=ColorField(default='#FF0000')Field OptionsThese are the supported custom options:format,image_field,samplesformatThe following formats are supported:hex(default),hexa,rgb,rgba.fromcolorfield.fieldsimportColorFieldfromdjango.dbimportmodelsclassMyModel(models.Model):color=ColorField(format="hexa")image_fieldIt is possible to auto-populate the field value getting the color from an image using theimage_fieldoption.The color will be calculated from thetop-left pixelcolor of the image each time the model instance is saved.fromcolorfield.fieldsimportColorFieldfromdjango.dbimportmodelsclassMyModel(models.Model):image=models.ImageField(upload_to="images")color=ColorField(image_field="image")samplesIt is possible to provide a palette of colors to choose from to the widget using thesamplesoption.This optionis not restrictive(on the contrary ofchoicesoption), it is also possible to choose another color from the spectrum.fromcolorfield.fieldsimportColorFieldfromdjango.dbimportmodelsclassMyModel(models.Model):COLOR_PALETTE=[("#FFFFFF","white",),("#000000","black",),]# not restrictive, allows the selection of another color from the spectrum.color=ColorField(samples=COLOR_PALETTE)# restrictive, it is mandatory to choose a color from the palettecolor=ColorField(choices=COLOR_PALETTE)AdminThe admin will kindly provide a simplecolor pickerfor all color fields. :)Testing# clone repositorygitclonehttps://github.com/fabiocaccamo/django-colorfield.git&&cddjango-colorfield# create virtualenv and activate itpython-mvenvvenv&&.venv/bin/activate# upgrade pippython-mpipinstall--upgradepip# install requirementspipinstall-rrequirements.txt-rrequirements-test.txt# install pre-commit to run formatters and linterspre-commitinstall--install-hooks# run teststox# orpythonruntests.py# orpython-mdjangotest--settings"tests.settings"CreditsOriginally developed byJared ForsythLicenseReleased underMIT License.Supporting:star: Star this project onGitHub:octocat: Follow me onGitHub:blue_heart: Follow me onTwitter:moneybag: Sponsor me onGithubSee alsodjango-admin-interface- the default admin interface made customizable by the admin itself. popup windows replaced by modals. 🧙 ⚡django-extra-settings- config and manage typed extra settings using just the django admin. ⚙️django-maintenance-mode- shows a 503 error page when maintenance-mode is on. 🚧 🛠️django-redirects- redirects with full control. ↪️django-treenode- probably the best abstract model / admin for your tree based stuff. 🌳python-benedict- dict subclass with keylist/keypath support, I/O shortcuts (base64, csv, json, pickle, plist, query-string, toml, xml, yaml) and many utilities. 📘python-codicefiscale- encode/decode Italian fiscal codes - codifica/decodifica del Codice Fiscale. 🇮🇹 💳python-fontbro- friendly font operations. 🧢python-fsutil- file-system utilities for lazy devs. 🧟‍♂️