How to compare colour values in Blender using Python?
Basically it's only possible to compare equal data types. By using python's built-in type() method on Material.diffuse_color the console yields it's an instance of the class Color:

&gt;&gt;&gt; type(bpy.data.materials.get("Red-Material").diffuse_color)
&gt;&gt;&gt; &lt;class 'Color'&gt;


Probably the simplest way is to access its 'components' by class attribute Material.diffuse_color.r or index operator Material.diffuse_color[0] and compare the values:

# Check if the red component is 1.0 via equal operator
&gt;&gt;&gt; bpy.data.materials.get("Red-Material").diffuse_color.r == 1 
&gt;&gt;&gt; True 
&gt;&gt;&gt; bpy.data.materials.get("Red-Material").diffuse_color[0] == 1 
&gt;&gt;&gt; True


However, you can also compare two class instances:

&gt;&gt;&gt; mat1_diff = bpy.data.materials.get("Red-Material-I").diffuse_color
&gt;&gt;&gt; mat2_diff = bpy.data.materials.get("Red-Material-II").diffuse_color
&gt;&gt;&gt; mat1_diff == mat2_diff
&gt;&gt;&gt; True


Means that you can create a custom color (class instance) via mathutils module to compare with:

&gt;&gt;&gt; import mathutils
&gt;&gt;&gt; my_red_color = mathutils.Color((1.0, 0.0, 0.0))
&gt;&gt;&gt; type (my_red_color)
&gt;&gt;&gt; &lt;class 'Color'&gt;
&gt;&gt;&gt; isinstance(my_red_color, Color)
&gt;&gt;&gt; True
# Compare color instance with diffuse color
&gt;&gt;&gt; bpy.data.materials.get("Red-Material").diffuse_color == my_red_color
&gt;&gt;&gt; True