|
1 | 1 | import { type CSSProperties, useEffect, useRef } from "react"; |
| 2 | +import { useThemeMode } from "~/hooks/useThemeMode"; |
2 | 3 |
|
3 | 4 | // Our own 5x5 dot-matrix system, reverse-engineered from dotmatrix |
4 | 5 | // (github.com/zzzzshawn/matrix) but written from scratch on canvas. |
@@ -117,6 +118,8 @@ export type DotMatrixPalette = { |
117 | 118 |
|
118 | 119 | export const DOT_MATRIX_PALETTES = { |
119 | 120 | mono: { stops: ["#e2e8f0", "#ffffff", "#94a3b8"], glow: "#ffffff" }, |
| 121 | + /** `mono` inverted, for light surfaces — the white ramp vanishes on white. */ |
| 122 | + monoLight: { stops: ["#0d0e12", "#1a1b1f", "#3b3e45"], glow: "#1a1b1f" }, |
120 | 123 | trigger: { stops: ["#41ff54", "#a4ff53", "#e7ff52"], glow: "#86ff53" }, |
121 | 124 | aurora: { stops: ["#ff3cac", "#784ba0", "#2b86c5"], glow: "#9c64bf" }, |
122 | 125 | ocean: { stops: ["#00c6ff", "#0072ff", "#4facfe"], glow: "#2f8fff" }, |
@@ -631,3 +634,25 @@ export function AgentDotMatrix({ |
631 | 634 | /> |
632 | 635 | ); |
633 | 636 | } |
| 637 | + |
| 638 | +/** |
| 639 | + * The agent's monochrome logo — the glyph that stands for the agent wherever it |
| 640 | + * appears (the ask-ai button, the panel's hero, the chat spinner). |
| 641 | + * |
| 642 | + * Use this instead of setting `palette="mono"` by hand: the mono ramp is |
| 643 | + * white-based, so on the light theme it would be white ink on a white panel. |
| 644 | + * The matrix draws on canvas and can't read a CSS variable, so the ink is |
| 645 | + * picked from the active theme here. |
| 646 | + */ |
| 647 | +export function AgentMonoLogo(props: Omit<AgentDotMatrixProps, "palette" | "restColor" | "mode">) { |
| 648 | + const mode = useThemeMode(); |
| 649 | + const light = mode === "light"; |
| 650 | + return ( |
| 651 | + <AgentDotMatrix |
| 652 | + {...props} |
| 653 | + mode={mode} |
| 654 | + palette={light ? "monoLight" : "mono"} |
| 655 | + restColor={light ? DOT_MATRIX_PALETTES.monoLight.glow : DOT_MATRIX_PALETTES.mono.glow} |
| 656 | + /> |
| 657 | + ); |
| 658 | +} |
0 commit comments