Skip to content

Commit b4c9ccb

Browse files
authored
feat: add rainbow shimmer animation (#52)
## Description Adds a dynamic rainbow shimmer animation effect to the RUNLOOP.ai banner. The banner now features an animated emerald green gradient that subtly shifts over time, creating a more engaging visual experience in the CLI. **Note:** PR titles should follow [Conventional Commits](https://www.conventionalcommits.org/) format (e.g., `feat(devbox): add support for custom env vars` or `fix(snapshot): resolve pagination issue`) as they are used for automatic release notes generation. ## Type of Change - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Documentation update - [ ] Code refactoring - [ ] Performance improvement - [ ] Test updates ## Related Issues N/A ## Changes Made - Replaced static gradient (teen/vice) with custom color arrays for light and dark modes - Added animated shimmer effect using React hooks (useState, useEffect) - Colors rotate every 250ms to create a subtle, continuous animation - Maintained theme awareness - different color palettes for light and dark modes - Used emerald green shades to align with Runloop brand colors (#10B981) ## Testing - [x] I have tested locally - [x] I have added/updated tests - [x] All existing tests pass (192/192 tests passed) ## Checklist - [x] My code follows the code style of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have updated the documentation accordingly - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] Any dependent changes have been merged and published ## Screenshots (if applicable) N/A - Terminal animation effect (CLI banner with shimmer) ## Additional Notes - The shimmer effect uses a 250ms interval for smooth, subtle animation - Color arrays contain 32 shades to create smooth transitions - useEffect cleanup properly clears the interval to prevent memory leaks - Component remains memoized for performance
1 parent 6ab24a5 commit b4c9ccb

1 file changed

Lines changed: 86 additions & 7 deletions

File tree

src/components/Banner.tsx

Lines changed: 86 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,98 @@
1-
import React from "react";
1+
import React, { useState, useEffect } from "react";
22
import { Box } from "ink";
33
import BigText from "ink-big-text";
44
import Gradient from "ink-gradient";
55
import { isLightMode } from "../utils/theme.js";
66

7+
// Dramatic shades of green shimmer - wide range
8+
const DARK_SHIMMER_COLORS = [
9+
"#024A38", // Very very dark emerald
10+
"#035544", //
11+
"#036050", //
12+
"#046C54", //
13+
"#04765C", //
14+
"#058164", //
15+
"#058C6D", //
16+
"#059669", // Deep emerald
17+
"#08A076", //
18+
"#0BA67B", //
19+
"#0EAE84", //
20+
"#10B981", // Runloop success green
21+
"#14C793", // Lighter emerald
22+
"#1CD7A7", //
23+
"#24E0B5", //
24+
"#30EAC0", //
25+
"#40F5CC", // Very bright emerald
26+
"#30EAC0", //
27+
"#24E0B5", //
28+
"#1CD7A7", //
29+
"#14C793", // Lighter emerald
30+
"#10B981", // Runloop success green
31+
"#0EAE84", //
32+
"#0BA67B", //
33+
"#08A076", //
34+
"#059669", // Deep emerald
35+
"#058C6D", //
36+
"#058164", //
37+
"#04765C", //
38+
"#046C54", //
39+
"#036050", //
40+
"#035544", //
41+
];
42+
43+
const LIGHT_SHIMMER_COLORS = [
44+
"#034D3A", // Very very deep emerald
45+
"#045540", //
46+
"#055D46", //
47+
"#065F46", //
48+
"#046A50", //
49+
"#047857", // Deep emerald
50+
"#058360", //
51+
"#058C68", //
52+
"#059669", // Runloop light success green
53+
"#08A076", //
54+
"#0BA67B", //
55+
"#0EAE84", //
56+
"#10B981", // Medium emerald
57+
"#14C793", // Lighter emerald
58+
"#18D29F", //
59+
"#1CDCA9", //
60+
"#20E5B3", //
61+
"#1CDCA9", //
62+
"#18D29F", //
63+
"#14C793", // Lighter emerald
64+
"#10B981", // Medium emerald
65+
"#0EAE84", //
66+
"#0BA67B", //
67+
"#08A076", //
68+
"#059669", // Runloop light success green
69+
"#058C68", //
70+
"#058360", //
71+
"#047857", // Deep emerald
72+
"#046A50", //
73+
"#065F46", //
74+
"#055D46", //
75+
"#045540", //
76+
];
77+
778
export const Banner = React.memo(() => {
8-
// Use theme-aware gradient colors
9-
// In light mode, use darker/deeper colors for better contrast on light backgrounds
10-
// "teen" has darker colors (blue/purple) that work well on light backgrounds
11-
// In dark mode, use the vibrant "vice" gradient (pink/cyan) that works well on dark backgrounds
12-
const gradientName = isLightMode() ? "teen" : "vice";
79+
const [offset, setOffset] = useState(0);
80+
const colors = isLightMode() ? LIGHT_SHIMMER_COLORS : DARK_SHIMMER_COLORS;
81+
82+
useEffect(() => {
83+
const interval = setInterval(() => {
84+
setOffset((prev) => (prev - 1 + colors.length) % colors.length);
85+
}, 250); // Slower, more subtle shimmer
86+
87+
return () => clearInterval(interval);
88+
}, [colors.length]);
89+
90+
// Create a subtle shimmer by shifting the color array
91+
const rotatedColors = [...colors.slice(offset), ...colors.slice(0, offset)];
1392

1493
return (
1594
<Box flexDirection="column" alignItems="flex-start" paddingX={1}>
16-
<Gradient name={gradientName}>
95+
<Gradient colors={rotatedColors}>
1796
<BigText text="RUNLOOP.ai" font="simple3d" />
1897
</Gradient>
1998
</Box>

0 commit comments

Comments
 (0)