Skip to content

Add a color field type to Custom Objects #671

Description

@bctiemann

Plugin Version

v0.6.0

Proposed functionality

Add a color field type to the Custom Objects field-type enum (cot_schema_v1.json, field_types.py), backed by NetBox's existing ColorField (from utilities.fields), reusing NetBox's built-in color-picker widget and swatch rendering, and NetBox's standard ColorChoices set.

Use case

NetBox plugins commonly use ColorField for labeling/categorization — for example netbox-public-clouds' CloudPlatform.color and CloudVMType.color (ColorField(default=ColorChoices.COLOR_GREY)). Today, modeling this in Custom Objects requires either:

  • a text field with a hex-format regex, which loses the swatch/color-picker UI entirely, or
  • a select field bound to a custom choice set populated with NetBox's ColorChoices values, which gives a colored badge on detail views but not a free-form color picker.

A first-class color field type would let Custom Objects fully replace this common plugin pattern rather than approximating it. This gap affects 3 of the 9 plugins surveyed.

External dependencies

None — reuses NetBox's existing ColorField and widget.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions