@@ -173,6 +173,8 @@ pub(crate) fn property_from_type(
173
173
Some ( x) if x == TypeId :: of :: < String > ( ) => text_widget ( default_info) . into ( ) ,
174
174
Some ( x) if x == TypeId :: of :: < DVec2 > ( ) => vec2_widget ( default_info, "X" , "Y" , "" , None , false ) ,
175
175
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 ( ) ) ,
176
178
// ==========================
177
179
// PRIMITIVE COLLECTION TYPES
178
180
// ==========================
@@ -926,6 +928,22 @@ pub fn color_widget(parameter_widgets_info: ParameterWidgetsInfo, color_button:
926
928
927
929
// Add the color input
928
930
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
+ ) ,
929
947
TaggedValue :: Color ( color_table) => widgets. push (
930
948
color_button
931
949
. value ( match color_table. iter ( ) . next ( ) {
@@ -965,7 +983,7 @@ pub fn color_widget(parameter_widgets_info: ParameterWidgetsInfo, color_button:
965
983
. on_commit ( commit_value)
966
984
. widget_holder ( ) ,
967
985
) ,
968
- _ => { }
986
+ x => warn ! ( "Colour {x:?}" ) ,
969
987
}
970
988
971
989
LayoutGroup :: Row { widgets }
0 commit comments