ClassesColorMapping
Last updated
Last updated
Classes Color Mapping
widget allows users to edit class colors on the fly. This widget can be used when you have classes with similar colors and you want to change them to be more distinguishable.
List of ObjClass
objects or Supervisely object class collection (ObjClassCollection
).
type: Union[List[ObjClass], ObjClassCollection]
If True
convert selected RGB color value to grayscale.
type: bool
default False
ID of the widget.
type: str
default value: None
You can find this example in our Github repository:
supervisely-ecosystem/ui-widgets-demos/input/010_classes_color_mapping/src/main.py
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
ClassesColorMapping
widgetClassesListPreview
widget to display changes and Button
widget to save changesPrepare a layout for app using Card
widget with the content
parameter and place widget that we've just created into the Container
widget.
Create an app object with layout parameter.
Parameters | Type | Description |
---|---|---|
Attributes and Methods | Description |
---|---|
classes
Union[List[ObjClass], ObjClassCollection]
Supervisely object class collection or list of object classes
grayscale
bool
If True
convert selected RGB color to grayscale
widget_id
str
ID of the widget
set()
Set classes to widget.
set_colors()
Set classes colors.
get_classes()
Get all classes.
get_selected_classes_original()
Get classes with original colors.
get_selected_classes_edited()
Get classes with selected colors.
get_mapping()
Get class to color map.
set_default()
Set multiple flag.
select()
Return list of all classes.