kiosko-plugin-fractals 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -56,6 +56,7 @@ function themePalette(theme, r, count = 3) {
56
56
  pool.push(rgb);
57
57
  }
58
58
  const accent = parseHex(c.accent);
59
+ if (distance(accent, ink) < 40 && pool.every((p) => distance(p, ink) < 40)) return ramp(bg, ink, light, [0.2, 0.55, 0.35]);
59
60
  const stops = [accent];
60
61
  const rest = pool.filter((p) => distance(p, accent) >= 40);
61
62
  while (stops.length < count && rest.length) stops.push(rest.splice(Math.floor(r() * rest.length), 1)[0]);
@@ -63,6 +64,13 @@ function themePalette(theme, r, count = 3) {
63
64
  const deep = light ? mix(accent, ink, 0.45) : mix(accent, bg, 0.45);
64
65
  stops.splice(1 + Math.floor(r() * (stops.length - 1)), 0, deep);
65
66
  const tuned = light ? stops.map((s) => mix(s, [0, 0, 0], 0.12)) : stops;
67
+ return { bg, ink, light, lut: lutOf(tuned), stops };
68
+ }
69
+ function ramp(bg, ink, light, towardsBg) {
70
+ const stops = towardsBg.map((t2) => mix(ink, bg, t2));
71
+ return { bg, ink, light, lut: lutOf(stops), stops };
72
+ }
73
+ function lutOf(tuned) {
66
74
  const lut = new Float32Array(SIZE * 3);
67
75
  for (let i = 0; i < SIZE; i++) {
68
76
  const t2 = i / SIZE * tuned.length;
@@ -75,7 +83,7 @@ function themePalette(theme, r, count = 3) {
75
83
  lut[i * 3 + 1] = a[1] + (b[1] - a[1]) * s;
76
84
  lut[i * 3 + 2] = a[2] + (b[2] - a[2]) * s;
77
85
  }
78
- return { bg, ink, light, lut, stops };
86
+ return lut;
79
87
  }
80
88
  function mix(a, b, t2) {
81
89
  return [a[0] + (b[0] - a[0]) * t2, a[1] + (b[1] - a[1]) * t2, a[2] + (b[2] - a[2]) * t2];
@@ -1849,7 +1857,7 @@ var coral = defineInterlude({
1849
1857
  var index_default = definePlugin({
1850
1858
  id: "fractals",
1851
1859
  name: { en: "Fractals", es: "Fractales", de: "Fraktale", "zh-Hans": "\u5206\u5F62", "zh-Hant": "\u788E\u5F62" },
1852
- version: "0.2.1",
1860
+ version: "0.2.3",
1853
1861
  description: {
1854
1862
  en: "Generative fractal interludes in your theme\u2019s colours: a fractal flame that develops like a photo, a morphing Julia set, a dive into the Mandelbrot set, a meadow of Barnsley ferns and growing coral.",
1855
1863
  es: "Interludios de fractales generativos con los colores de tu tema: una llama fractal que se revela como una foto, un conjunto de Julia que se transforma, una inmersi\xF3n en el conjunto de Mandelbrot, un prado de helechos de Barnsley y coral que crece.",
@@ -9,7 +9,7 @@
9
9
  "zh-Hans": "分形",
10
10
  "zh-Hant": "碎形"
11
11
  },
12
- "version": "0.2.2",
12
+ "version": "0.2.3",
13
13
  "description": {
14
14
  "en": "Generative fractal interludes in your theme’s colours: a fractal flame that develops like a photo, a morphing Julia set, a dive into the Mandelbrot set, a meadow of Barnsley ferns and growing coral.",
15
15
  "es": "Interludios de fractales generativos con los colores de tu tema: una llama fractal que se revela como una foto, un conjunto de Julia que se transforma, una inmersión en el conjunto de Mandelbrot, un prado de helechos de Barnsley y coral que crece.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kiosko-plugin-fractals",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Generative fractal interludes for Kiosko in your theme’s colours: a fractal flame that develops like a photo, a morphing Julia set, a Mandelbrot dive, a meadow of Barnsley ferns and growing coral.",
5
5
  "type": "module",
6
6
  "license": "MIT",