File tree Expand file tree Collapse file tree
shared-bindings/displayio Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,7 +66,20 @@ STATIC mp_obj_t displayio_palette_make_new(const mp_obj_type_t *type, size_t n_a
6666
6767 return MP_OBJ_FROM_PTR (self );
6868}
69-
69+ //| .. method:: __setitem__(index, value)
70+ //|
71+ //| Sets the pixel color at the given index. The index should be an integer in the range 0 to color_count-1.
72+ //|
73+ //| The value argument represents a color, and can be from 0x000000 to 0xFFFFFF (to represent an RGB value).
74+ //| Value can be an int, bytes (3 bytes (RGB) or 4 bytes (RGB + pad byte)), or bytearray.
75+ //|
76+ //| This allows you to::
77+ //|
78+ //| palette[0] = 0xFFFFFF # set using an integer
79+ //| palette[1] = b'\xff\xff\x00' # set using 3 bytes
80+ //| palette[2] = b'\xff\xff\x00\x00' # set using 4 bytes
81+ //| palette[3] = bytearray(b'\x00\x00\xFF') # set using a bytearay of 3 or 4 bytes
82+ //|
7083STATIC mp_obj_t palette_subscr (mp_obj_t self_in , mp_obj_t index_in , mp_obj_t value ) {
7184 if (value == MP_OBJ_NULL ) {
7285 // delete item
You can’t perform that action at this time.
0 commit comments