aboutsummaryrefslogtreecommitdiff
path: root/docs/Scripting/SupportLib/README.md
diff options
context:
space:
mode:
authorJakob Stendahl <jakob.stendahl@outlook.com>2021-09-19 19:43:11 +0200
committerJakob Stendahl <jakob.stendahl@outlook.com>2021-09-19 19:43:11 +0200
commit7bdce37fd3f18e2712e18c4e2c64cac69af0aca1 (patch)
treeb7ad3f1cca92e2dfd2664ae9e65652bd03ff58b2 /docs/Scripting/SupportLib/README.md
parente6880cd8ccf82d993f222cb14b4860581654acb8 (diff)
downloadLuxcena-Neo-7bdce37fd3f18e2712e18c4e2c64cac69af0aca1.tar.gz
Luxcena-Neo-7bdce37fd3f18e2712e18c4e2c64cac69af0aca1.zip
:boom: Introduce new UI based on svelte, and rewrite a lot of the node app and the NeoRuntime
Diffstat (limited to 'docs/Scripting/SupportLib/README.md')
-rw-r--r--docs/Scripting/SupportLib/README.md70
1 files changed, 34 insertions, 36 deletions
diff --git a/docs/Scripting/SupportLib/README.md b/docs/Scripting/SupportLib/README.md
index 537a6ba..92f69c4 100644
--- a/docs/Scripting/SupportLib/README.md
+++ b/docs/Scripting/SupportLib/README.md
@@ -6,61 +6,59 @@
This is the object you are refeering to when you want to do things with LED's.
You shouldn't have to do instantiate your own new strip-object as you can use the one
set up by the software itself.
-```python
-LuxcenaNeo.strip
-or
-neo.strip
-```
-### Strip.show()
+### strip.show()
Display all the changes made to the LEDs, on the actual LEDs.
-### Strip.setPixelColor(`n`, `color`)
+### strip.set_pixel_color(`n`, `*color`)
Set LED at position n to the provided 24-bit color value (in RGB order).
-### Strip.setPixelColorXY(`x`, `y`, `color`)
+### strip.set_pixel_color_XY(`x`, `y`, `*color`)
Set LED at position (x, y) in the defined matrix to the provided 24-bit color value (in RGB order).
-### Strip.setPixelColorRGB(`n`, `red`, `green`, `blue`, `white = 0`)
-Set LED at position n to the provided red, green, and blue color.
-Each color component should be a value from 0 to 255 (where 0 is the
-lowest intensity and 255 is the highest intensity).
-
-### Strip.setPixelColorXYRGB(`x`, `y`, `red`, `green`, `blue`, `white = 0`)
-Set LED at position (x, y) in the defined matrix to the provided red, green, and blue color.
-Each color component should be a value from 0 to 255 (where 0 is the
-lowest intensity and 255 is the highest intensity).
-
-### Strip.setSegmentColorRGB(`segment`, `red`, `green`, `blue`, `white = 0`)
+### strip.set_segment_color(`segment`, `*color`)
Set a whole segment to the provided red, green and blue color.
Each color component should be a value from 0 to 255 (where 0 is the
lowest intensity and 255 is the highest intensity).
-### Strip.setBrightness(`brightness`)
-Scale each LED in the buffer by the provided brightness. A brightness
-of 0 is the darkest and 255 is the brightest.
-
-### Strip.getBrightness():
-Get the brightness value for each LED in the buffer. A brightness
-of 0 is the darkest and 255 is the brightest.
-
-### Strip.getPixels():
+### strip.get_pixels():
Return an object which allows access to the LED display data as if
it were a sequence of 24-bit RGB values.
-### Strip.numPixels():
+### strip.num_pixels():
Return the number of pixels in the display.
-### Strip.getPixelColor(`n`)
+### strip.get_pixel_color(`n`)
Get the 24-bit RGB color value for the LED at position n.
+## `*color``
+All functions that take in this, will automatically parse the value provided.
+
+If parameter is only a str, it will be treated as a hex value. e.g. `set_pixel_color(0, "#fafafa")`
+If parameter is a tuple, the first three items in that tuple will be treated as a rgb value. e.g. `set_pixel_color(0, (255, 238, 10))`
+If parameter is a int, it will be treated as a 24-bit color value. e.g. `set_pixel_color(0, 2812873)`
+If there are 3 parameters, these will be treated as a rgb value. e.g. `set_pixel_color(0, 255, 238, 10)`
+This means that all of these have the same effect:
+```
+set_pixel_color(0, "#fafafa")
+set_pixel_color(0, 16448250)
+set_pixel_color(0, 250, 250, 250)
+set_pixel_color(0, (250, 250, 250))
+```
+
---
-## Color(`red`, `green`, `blue`, `white = 0`)
-Convert the provided red, green, blue color to a 24-bit color value.
-Each color component should be a value 0-255 where 0 is the lowest intensity
-and 255 is the highest intensity.
+These are in `utils`, can be imported with `from luxcena_neo import utils`.
+
+## utils.hex_to_rgb(`value`)
+Convert provided hex color to a tuple with rgb colors. (r, g, b).
+
+## utils.rgb_to_hex(`rgb`)
+Converts rgb colors in tuple to hex string.
+
+## utils.rgb_from_24bit(`color`)
+Takes a 24bit color value and returns a rgb tuple.
-## hexColor(`value`)
-Convert the provided hexadecimal color to a 24-bit color value.
+## utils.rgb_from_24bit(`color`)
+Takes a 24bit color value and returns a hex string.