how to change mat diff color on ob ?

I can list all mat on ob with mat name
but then how do you change the diff color ?



    for i, mat in enumerate(mesh.material_slots):
#     print (' dir mat =', dir(mat ))
     if not i:
      print("material_slots")
     if mat is not None:
      print("	[%d] = %s" % (i, mat.name))
#      print ('material = ', mat.material)
      
#      print (' dir mat =', dir(mat ))
#      print("	[%d] = %s Diff color = %f" % (i, mat.name,mat.))
     else:
 
      print("	[%d] is None" % I)




either change for a new mat or only change the RGB value
and instead of using the RGB value is it possible to use the HSV value ?

I can get mat list from

for item in bpy.data.materials:
  
     print (item.name,' RGB =',item.diffuse_color)

but how do you get the HSV or change it ?

thanks
happy bl

Hi RickyBlender,

Here is a example to change the color to red:
item.diffuse_color = (1,0,0) #RGB

And to convert RGB to HSV and HSV to RGB you can use these functions:
import colorsys

colorsys.rgb_to_hsv(r, g, b)

colorsys.hsv_to_rgb(h, s, v)

i finaly found way to get it form the object’s list of mat
then use the mat list

will take not of these conversion formulas

thanks
happy bl