@@ -173,6 +173,8 @@ pub(crate) fn property_from_type(
173173 Some ( x) if x == TypeId :: of :: < String > ( ) => text_widget ( default_info) . into ( ) ,
174174 Some ( x) if x == TypeId :: of :: < DVec2 > ( ) => vec2_widget ( default_info, "X" , "Y" , "" , None , false ) ,
175175 Some ( x) if x == TypeId :: of :: < DAffine2 > ( ) => transform_widget ( default_info, & mut extra_widgets) ,
176+ Some ( x) if x == TypeId :: of :: < Color > ( ) => color_widget ( default_info, ColorInput :: default ( ) ) ,
177+ Some ( x) if x == TypeId :: of :: < Option < Color > > ( ) => color_widget ( default_info, ColorInput :: default ( ) ) ,
176178 // ==========================
177179 // PRIMITIVE COLLECTION TYPES
178180 // ==========================
@@ -926,6 +928,22 @@ pub fn color_widget(parameter_widgets_info: ParameterWidgetsInfo, color_button:
926928
927929 // Add the color input
928930 match & * * tagged_value {
931+ TaggedValue :: ColorNotInTable ( color) => widgets. push (
932+ color_button
933+ . value ( FillChoice :: Solid ( * color) )
934+ . allow_none ( false )
935+ . on_update ( update_value ( |input : & ColorInput | TaggedValue :: ColorNotInTable ( input. value . as_solid ( ) . unwrap ( ) ) , node_id, index) )
936+ . on_commit ( commit_value)
937+ . widget_holder ( ) ,
938+ ) ,
939+ TaggedValue :: OptionalColorNotInTable ( color) => widgets. push (
940+ color_button
941+ . value ( color. map_or ( FillChoice :: None , FillChoice :: Solid ) )
942+ . allow_none ( true )
943+ . on_update ( update_value ( |input : & ColorInput | TaggedValue :: OptionalColorNotInTable ( input. value . as_solid ( ) ) , node_id, index) )
944+ . on_commit ( commit_value)
945+ . widget_holder ( ) ,
946+ ) ,
929947 TaggedValue :: Color ( color_table) => widgets. push (
930948 color_button
931949 . value ( match color_table. iter ( ) . next ( ) {
@@ -965,7 +983,7 @@ pub fn color_widget(parameter_widgets_info: ParameterWidgetsInfo, color_button:
965983 . on_commit ( commit_value)
966984 . widget_holder ( ) ,
967985 ) ,
968- _ => { }
986+ x => warn ! ( "Colour {x:?}" ) ,
969987 }
970988
971989 LayoutGroup :: Row { widgets }
0 commit comments