using hsl

This commit is contained in:
Clément Le Bihan
2021-12-10 15:53:01 +01:00
parent 2f2d5bc58a
commit 21bf914ebf
+11 -5
View File
@@ -3,9 +3,9 @@ from chroma_case.Note import Note
import asyncio import asyncio
import sys import sys
import board, neopixel #import board, neopixel
pixels = neopixel.NeoPixel(board.D18, 20, brightness=0.1) #pixels = neopixel.NeoPixel(board.D18, 20, brightness=0.1)
notePixels = { 'si': [0, 1], notePixels = { 'si': [0, 1],
'la#': [2, 3], 'la#': [2, 3],
@@ -35,9 +35,15 @@ def hsl_to_rgb(hue, sat, light):
else: else:
t2 = light + sat - (light * sat) t2 = light + sat - (light * sat)
t1 = light * 2 - t2 t1 = light * 2 - t2
return (hue_to_rgb(t1, t2, hue + 2) * 255,
hue_to_rgb(t1, t2, hue) * 255, r = hue_to_rgb(t1, t2, hue + 2) * 255,
hue_to_rgb(t1, t2, hue - 2) * 255) g = hue_to_rgb(t1, t2, hue) * 255,
b = hue_to_rgb(t1, t2, hue - 2) * 255
return (round(r), round(g), round(b))
print(hsl_to_rgb())
pixels = {}
async def to_chroma_case(data): async def to_chroma_case(data):
global pixels global pixels