I am attempting to create a plane and set the color; the following code throws an error at this line:


the error is: ValueError: bpy_struct: item.attr = val: sequences of dimension 0 should contain 4 items, not 3

which makes no sense to me; diffuse_color calls for 3 parameters in the documentation.


1 Answer 1


You saw the wrong version of document, 2.80 change a lot. Ones should always use new document page for 2.80 version:

Material(ID) - Blender 2.80 API (latest)


Diffuse color of the material

Type: float array of 4 items in [0, inf], default (0.8, 0.8, 0.8, 0.8)

last update: 2020-08-04 Blender 2.91 Alpha

The four values are represented as: [Red, Green, Blue, Alpha] by default rendering pipeline. These values may stay from 0.0 to 1.0 if the color is interpreted as diffuse. Other wise, it doesn't need to less than 1. eg. a light color node might contain a value more than 1 unit.

  • $\begingroup$ What do the parameters mean? R,G,B,? ?? $\endgroup$
    – vndep
    Jul 12, 2019 at 23:53
  • 2
    $\begingroup$ @vndep RGB and Alpha $\endgroup$
    – Sazerac
    Jul 13, 2019 at 0:30
  • $\begingroup$ I am trying to get a green color (RGB=0,113,57; hex=#007139). When I pass the array (0,113,57,1) to .diffuse_color I get a light blue color instead. Same result when I convert the 0-255 values to percentiles. Any suggestions as to how to get that green? Maybe diffusion_color isn't the right property? $\endgroup$
    – vndep
    Jul 13, 2019 at 1:17
  • 2
    $\begingroup$ @vndep The description say it is an float number, and you should always consider the color value is in 0 to 1 rather 0 to 255. Divide your color value by 255 to fix it $\endgroup$
    – HikariTW
    Jul 13, 2019 at 1:40
  • $\begingroup$ Thanks! That solves it. $\endgroup$
    – vndep
    Jul 13, 2019 at 9:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .