Inline Highlight
Word color change animation for Remotion: one word in a sentence shifts from the text color to a brand color, with no background, marker or underline behind it.
In Remotion, Inline Highlight animates one word in a sentence so it shifts from the normal text color to a brand color, with no background, marker or underline behind it. Use it to point at a product name or key term in a headline that is already on screen.
$ pnpm dlx shadcn@latest add @remocn/inline-highlightHow to build this in Remotion
This is the whole effect in a few lines, already written. Install the component and pass the sentence in three parts:
npx shadcn@latest add @remocn/inline-highlightIt uses Remotion's interpolateColors() on a progress value from interpolate(), clamped at both ends. The color shift is one element in timeline.ts, so the sentence never reflows: only the color of the middle span changes.
Good to know
- Length: 90 frames of motion at 30 fps (180 at 60 fps) with the default props. The shift is timed as a share of the composition, not in fixed frames: it starts at 20% of
durationInFramesand ends at 70%, linearly. A 60 fps composition of 180 frames gives the same timing in seconds as 90 at 30 fps. The Usage example below is a 60 fps composition, so the numbers it hands to Remotion are doubled, see Frame rate. - Installs:
remotionfrom npm, plus the remocn helpersframe-rate,timeline. The shadcn CLI copies the source into your project. - Font: Geist Sans through the
--font-geist-sansCSS variable, with a system sans fallback. The font is set inline, so change it in the copied file; aclassNamefont does not override an inline style. - Start and length: there are no delay or duration props, but the component takes a
timingprop (Timing<"highlight">from the remocntimelinehelper) that moves, trims or stretches the color shift. For a different curve, edit theinterpolate()call in the copied file. - The scene paints a white background and centers the line; the default text color is
#171717and the highlight#ff5e3a.
Usage
// src/Root.tsx
import { Composition } from "remotion";
import { InlineHighlight } from "@/components/remocn/inline-highlight";
const InlineHighlightScene = () => (
<InlineHighlight
before="Ship faster with "
highlight="remocn"
highlightColor="#ff5e3a"
fontSize={72}
/>
);
export const RemotionRoot = () => (
<Composition
id="InlineHighlight"
component={InlineHighlightScene}
durationInFrames={180}
fps={60}
width={1280}
height={720}
/>
);Props8
| Prop | Type | Default |
|---|---|---|
| beforerequired | string— Text rendered before the highlighted word | |
| highlightrequired | string— The word that animates color | |
| after | string"" Text rendered after the highlighted word | |
| baseColor | string"#171717" Starting color of the highlighted word and color of the surrounding text | |
| highlightColor | string"#ff5e3a" Final color of the highlighted word | |
| fontSize | number48 Font size in pixels | |
| fontWeight | number600 CSS font-weight | |
| className | string— Optional className passed to the underlying span | |
- beforerequiredstring
Text rendered before the highlighted word
- highlightrequiredstring
The word that animates color
- afterstring
Text rendered after the highlighted word
Default
"" - baseColorstring
Starting color of the highlighted word and color of the surrounding text
Default
"#171717" - highlightColorstring
Final color of the highlighted word
Default
"#ff5e3a" - fontSizenumber
Font size in pixels
Default
48 - fontWeightnumber
CSS font-weight
Default
600 - classNamestring
Optional className passed to the underlying span
Common questions
How do I change the color of one word in a sentence in Remotion, with no marker behind it?
Install Inline Highlight with npx shadcn@latest add @remocn/inline-highlight and pass before, highlight and after, plus highlightColor. The word fades from baseColor to highlightColor with interpolateColors().
When does the color change?
From 20% to 70% of the composition length. Use the timing prop to move or stretch it.
Related effects
- Marker Highlight: a marker block painted behind the phrase.
- Shimmer Sweep: a metallic shine passing over visible text.
- Glass Capsule: a glass capsule magnifies one key word.
- Inline Pill Takeover: a pill inside a sentence grows into a CTA.