2023-07-20 22:27:24 -04:00
|
|
|
import { ComponentChildren, JSX } from "preact";
|
|
|
|
import { Main, render_and_copy } from "./common.tsx";
|
|
|
|
|
2023-07-20 22:43:01 -04:00
|
|
|
// don't want to do randomly on since it's not unique anyway
|
2023-07-20 22:46:45 -04:00
|
|
|
const Pixel = () => (
|
2023-07-20 22:27:24 -04:00
|
|
|
<details
|
|
|
|
class="toggle"
|
|
|
|
style="position: relative; margin: 0; cursor: pointer;"
|
|
|
|
>
|
2023-07-20 22:43:01 -04:00
|
|
|
<summary
|
2023-07-20 22:52:40 -04:00
|
|
|
style="list-style: none; display: block; width: 100%; height: 100%;"
|
2023-07-20 22:46:45 -04:00
|
|
|
class="off"
|
2023-07-20 22:43:01 -04:00
|
|
|
></summary>
|
|
|
|
<div
|
2023-07-20 22:52:40 -04:00
|
|
|
style="display: block; width: 100%; height: 100%; position: absolute; top: 0; pointer-events: none;"
|
2023-07-20 22:46:45 -04:00
|
|
|
class="on"
|
2023-07-20 22:43:01 -04:00
|
|
|
></div>
|
2023-07-20 22:27:24 -04:00
|
|
|
</details>
|
|
|
|
);
|
|
|
|
|
2023-07-20 22:43:01 -04:00
|
|
|
const Pixels = ({
|
|
|
|
n,
|
|
|
|
color_a,
|
|
|
|
color_b,
|
|
|
|
}: {
|
|
|
|
n: number;
|
|
|
|
color_a: string;
|
|
|
|
color_b: string;
|
2023-07-20 22:46:45 -04:00
|
|
|
}) => <>{...new Array(n).fill(null).map(Pixel)}</>;
|
2023-07-20 22:27:24 -04:00
|
|
|
|
|
|
|
render_and_copy(
|
|
|
|
<Main>
|
2023-07-20 22:43:01 -04:00
|
|
|
<Pixels
|
2023-07-20 23:30:25 -04:00
|
|
|
n={20 ** 2}
|
2023-07-20 22:43:01 -04:00
|
|
|
color_a="rgb(var(--color-background))"
|
|
|
|
color_b="rgb(var(--color-foreground))"
|
|
|
|
/>
|
2023-07-20 22:27:24 -04:00
|
|
|
</Main>
|
|
|
|
);
|