summaryrefslogtreecommitdiff
path: root/shared-bindings
diff options
context:
space:
mode:
authorMatt Land <matt-land@users.noreply.github.com>2019-05-10 16:41:13 -0500
committerGitHub <noreply@github.com>2019-05-10 16:41:13 -0500
commit214dfed703e81770b3a74df09ce13d8f86fa7211 (patch)
treea70fcdfd9e5ed65bf2abdbd6908b6f9312490148 /shared-bindings
parent36e2faf8d2212a30974cf7069075053ad8af28d0 (diff)
Add documentation for Palette shared binding
Add documentation for the palette subscript operator and how to use it.
Diffstat (limited to 'shared-bindings')
-rw-r--r--shared-bindings/displayio/Palette.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/shared-bindings/displayio/Palette.c b/shared-bindings/displayio/Palette.c
index 799d42bef..55692eae1 100644
--- a/shared-bindings/displayio/Palette.c
+++ b/shared-bindings/displayio/Palette.c
@@ -66,7 +66,17 @@ STATIC mp_obj_t displayio_palette_make_new(const mp_obj_type_t *type, size_t n_a
return MP_OBJ_FROM_PTR(self);
}
-
+//| .. method:: __setitem__(index, value)
+//|
+//| Sets the pixel color at the given index. The index should be an integer in the range 0 to color_count-1
+//|
+//| The color can be from 0x000000 to 0xFFFFFF, and can be an int or bytes (3 bytes (RGB) or 4 bytes (RGB + pad byte))
+//|
+//| This allows you to::
+//|
+//| palette[0] = 0xFFFFFF
+//| palette[1] = 0xFF0000
+//|
STATIC mp_obj_t palette_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value) {
if (value == MP_OBJ_NULL) {
// delete item