OpenCode
Animated OpenCode TUI welcome screen — two-tone wordmark, an input box with a blue accent bar that types a query, a model status line, and command hints. Dark/light themes.
Source
components/kuchi/opencode.tsx
1"use client";23import { loadFont } from "@remotion/google-fonts/JetBrainsMono";4import {5 AbsoluteFill,6 interpolate,7 spring,8 useCurrentFrame,9 useVideoConfig,10} from "remotion";11import { Caret } from "@/components/kuchi/type-caret";12import { useTypewriter } from "@/lib/kuchi-kit";1314const { fontFamily: MONO_FAMILY } = loadFont();1516export interface OpenCodeProps {17 placeholder?: string;18 query?: string;19 agentName?: string;20 modelName?: string;21 provider?: string;22 accentColor?: string;23 speed?: number;24}2526interface Theme {27 page: string;28 boxBg: string;29 fg: string;30 fgMuted: string;31 fgQuery: string;32 logoOpen: string;33 logoCode: string;34}3536export const THEMES: Record<"light" | "dark", Theme> = {37 light: {38 page: "#FFFFFF",39 boxBg: "#F2F2F2",40 fg: "#111111",41 fgMuted: "#888888",42 fgQuery: "#555555",43 logoOpen: "#999999",44 logoCode: "#111111",45 },46 dark: {47 page: "#000000",48 boxBg: "#161616",49 fg: "#EDEDED",50 fgMuted: "#6B6B6B",51 fgQuery: "#9A9A9A",52 logoOpen: "#6B6B6B",53 logoCode: "#EDEDED",54 },55};5657export const TYPING_START_FRAME = 48;5859export const TYPING_CPS = 20;6061function introBounceIn(62 frame: number,63 fps: number,64): { translateY: number; scale: number } {65 const s = spring({66 fps,67 frame,68 config: { damping: 14, stiffness: 110, mass: 0.7 },69 });70 const translateY = interpolate(s, [0, 1], [28, 0]);71 const scale = interpolate(s, [0, 1], [0.97, 1]);72 return { translateY, scale };73}7475function fadeUpAt(76 frame: number,77 range: [number, number],78): { opacity: number; translateY: number } {79 const opts = {80 extrapolateLeft: "clamp" as const,81 extrapolateRight: "clamp" as const,82 };83 return {84 opacity: interpolate(frame, range, [0, 1], opts),85 translateY: interpolate(frame, range, [12, 0], opts),86 };87}8889export function OpenCode({90 placeholder = "Ask anything... ",91 query = '"What is the tech stack of this project?"',92 agentName = "Build",93 modelName = "Kimi K2.5",94 provider = "Moonshot AI",95 accentColor = "#2B7FFF",96 speed = 1,97}: OpenCodeProps) {98 const frame = useCurrentFrame();99 const { width, height, fps } = useVideoConfig();100 const t = THEMES.dark;101102 const refW = 1280;103 const refH = 720;104 const stageScale = Math.min(width / refW, height / refH);105106 const tw = useTypewriter(query, {107 cps: TYPING_CPS,108 speed,109 startFrame: TYPING_START_FRAME,110 });111112 const intro = introBounceIn(frame * speed, fps);113 const logoFade = fadeUpAt(frame * speed, [4, 22]);114 const boxFade = fadeUpAt(frame * speed, [12, 30]);115 const hintsFade = fadeUpAt(frame * speed, [20, 38]);116117 const boxWidth = 1000;118119 return (120 <AbsoluteFill style={{ background: "transparent" }}>121 <div122 style={{123 position: "absolute",124 left: "50%",125 top: "50%",126 width: refW,127 height: refH,128 translate: "-50% -50%",129 scale: `${stageScale}`,130 display: "flex",131 flexDirection: "column",132 alignItems: "center",133 justifyContent: "center",134 }}135 >136 <div137 style={{138 lineHeight: 0,139 opacity: logoFade.opacity,140 translate: `0 ${logoFade.translateY + intro.translateY * 0.4}px`,141 }}142 >143 <svg144 width={468}145 height={84}146 viewBox="0 0 234 42"147 fill="none"148 xmlns="http://www.w3.org/2000/svg"149 >150 <title>opencode</title>151 <clipPath id="opencode-wordmark-clip">152 <rect width={234} height={42} fill="#ffffff" />153 </clipPath>154 <g clipPath="url(#opencode-wordmark-clip)">155 <path d="M18 30H6V18H18V30Z" fill="#4B4646" />156 <path d="M18 12H6V30H18V12ZM24 36H0V6H24V36Z" fill="#B7B1B1" />157 <path d="M48 30H36V18H48V30Z" fill="#4B4646" />158 <path159 d="M36 30H48V12H36V30ZM54 36H36V42H30V6H54V36Z"160 fill="#B7B1B1"161 />162 <path d="M84 24V30H66V24H84Z" fill="#4B4646" />163 <path164 d="M84 24H66V30H84V36H60V6H84V24ZM66 18H78V12H66V18Z"165 fill="#B7B1B1"166 />167 <path d="M108 36H96V18H108V36Z" fill="#4B4646" />168 <path169 d="M108 12H96V36H90V6H108V12ZM114 36H108V12H114V36Z"170 fill="#B7B1B1"171 />172 <path d="M144 30H126V18H144V30Z" fill="#4B4646" />173 <path d="M144 12H126V30H144V36H120V6H144V12Z" fill="#F1ECEC" />174 <path d="M168 30H156V18H168V30Z" fill="#4B4646" />175 <path176 d="M168 12H156V30H168V12ZM174 36H150V6H174V36Z"177 fill="#F1ECEC"178 />179 <path d="M198 30H186V18H198V30Z" fill="#4B4646" />180 <path181 d="M198 12H186V30H198V12ZM204 36H180V6H198V0H204V36Z"182 fill="#F1ECEC"183 />184 <path d="M234 24V30H216V24H234Z" fill="#4B4646" />185 <path186 d="M216 12V18H228V12H216ZM234 24H216V30H234V36H210V6H234V24Z"187 fill="#F1ECEC"188 />189 </g>190 </svg>191 </div>192193 <div194 style={{195 width: boxWidth,196 marginTop: 40,197 minHeight: 150,198 background: t.boxBg,199 borderLeft: `4px solid ${accentColor}`,200 padding: "26px 28px",201 boxSizing: "border-box",202 display: "flex",203 flexDirection: "column",204 justifyContent: "center",205 gap: 26,206 opacity: boxFade.opacity,207 translate: `0 ${boxFade.translateY + intro.translateY * 0.6}px`,208 scale: `${intro.scale}`,209 transformOrigin: "center top",210 }}211 >212 <div213 style={{214 display: "inline-flex",215 alignItems: "center",216 fontFamily: MONO_FAMILY,217 fontSize: 22,218 }}219 >220 <span style={{ color: t.fgMuted }}>{placeholder}</span>221 {tw.count > 0 ? (222 <span style={{ color: t.fgQuery }}>{tw.text}</span>223 ) : null}224 <span style={{ opacity: 0.6, display: "inline-flex" }}>225 <Caret226 width={12}227 height={24}228 color={t.fg}229 blink={!tw.typing}230 speed={speed}231 marginLeft={2}232 />233 </span>234 </div>235236 <div237 style={{238 display: "flex",239 flexDirection: "row",240 alignItems: "center",241 gap: 16,242 fontFamily: MONO_FAMILY,243 fontSize: 20,244 }}245 >246 <span style={{ color: accentColor, fontWeight: 600 }}>247 {agentName}248 </span>249 <span style={{ color: t.fg }}>{modelName}</span>250 <span style={{ color: t.fgMuted }}>{provider}</span>251 </div>252 </div>253254 <div255 style={{256 width: boxWidth,257 marginTop: 18,258 display: "flex",259 justifyContent: "flex-end",260 gap: 22,261 fontFamily: MONO_FAMILY,262 fontSize: 18,263 opacity: hintsFade.opacity,264 translate: `0 ${hintsFade.translateY}px`,265 }}266 >267 <span style={{ display: "inline-flex", gap: 8 }}>268 <span style={{ color: t.fg, fontWeight: 700 }}>tab</span>269 <span style={{ color: t.fgMuted }}>agents</span>270 </span>271 <span style={{ display: "inline-flex", gap: 8 }}>272 <span style={{ color: t.fg, fontWeight: 700 }}>ctrl+p</span>273 <span style={{ color: t.fgMuted }}>commands</span>274 </span>275 </div>276 </div>277 </AbsoluteFill>278 );279}







