diff --git a/ledcontrol/animationpatterns.py b/ledcontrol/animationpatterns.py index a014707..129ef65 100644 --- a/ledcontrol/animationpatterns.py +++ b/ledcontrol/animationpatterns.py @@ -15,7 +15,7 @@ def blank(t, dt, x, y, prev_state): return (0, 0, 0), ColorMode.hsv -static_patterns = [0, 1] # pattern IDs that display a solid color +static_patterns = [0, 1, 2] # pattern IDs that display a solid color default = { 0: { @@ -28,6 +28,15 @@ def pattern(t, dt, x, y, z, prev_state): ''' }, 1: { + 'name': 'Static White', + 'primary_speed': 0.0, + 'primary_scale': 1.0, + 'source': ''' +def pattern(t, dt, x, y, z, prev_state): + return (0, 0, 1), hsv +''' + }, + 2: { 'name': 'Static Gradient 1D', 'primary_speed': 0.0, 'primary_scale': 1.0, @@ -36,7 +45,7 @@ def pattern(t, dt, x, y, z, prev_state): return palette(x), hsv ''' }, - 2: { + 3: { 'name': 'Static Gradient Mirrored 1D', 'primary_speed': 0.0, 'primary_scale': 1.0, diff --git a/ledcontrol/colorpalettes.py b/ledcontrol/colorpalettes.py index 8057076..35bfb94 100644 --- a/ledcontrol/colorpalettes.py +++ b/ledcontrol/colorpalettes.py @@ -189,37 +189,6 @@ ] ], }, - 60: { - 'name': 'Tropical', - 'mode': 0, - 'colors': [ - [ - 0.8091639350442326, - 1, - 1 - ], - [ - 0.7397193908691406, - 0.9472211085328268, - 1 - ], - [ - 0.07063562729779412, - 0.23162477825759747, - 1 - ], - [ - 0.09412428911994487, - 1, - 1 - ], - [ - 0.05739369111902574, - 1, - 1 - ] - ], - }, 70: { 'name': 'Viridis', 'mode': 0, @@ -398,8 +367,8 @@ 1 ], [ - 0.9542738970588235, - 0.32107431954200116, + 0.5804735071518842, + 0.24538624614750573, 1 ] ], diff --git a/ledcontrol/static/js/main.js b/ledcontrol/static/js/main.js index 50a2aee..8ee17bf 100644 --- a/ledcontrol/static/js/main.js +++ b/ledcontrol/static/js/main.js @@ -244,9 +244,14 @@ function updatePaletteColorBar() { f = f % sectorSize / sectorSize; const c1 = palette.colors[sector]; const c2 = palette.colors[sector + 1]; - const h1 = c2[0] - c1[0]; - const h2 = c2[0] - 1 - c1[0]; - const h = (f * (Math.abs(h1) < Math.abs(h2) || h1 === 1 ? h1 : h2) + c1[0]) * 360; + let h1 = c2[0] - c1[0]; + // Allow full spectrum if extremes are 0 and 1 in any order + // otherwise pick shortest path between colors + if (Math.abs(h1) != 1) { + if (h1 < -0.5) h1++; + if (h1 > 0.5) h1--; + } + const h = (f * h1 + c1[0]) * 360; const s = (f * (c2[1] - c1[1]) + c1[1]) * 100; const v = (f * (c2[2] - c1[2]) + c1[2]) * 100; const l = (2 - s / 100) * v / 2;