Add a splash of color to your Articulate Storyline e-learning courses with a stunning rainbow gradient text effect using JavaScript. Whether you’re designing an inclusive Pride-themed lesson or simply want to wow learners, this tutorial shows how to use JavaScript triggers to dynamically apply a multi-color gradient to text elements.
🌈 Why Use a Gradient in Storyline?
A rainbow gradient not only enhances visual appeal, but also signals creativity, inclusion, and polish in your course design. Since Articulate Storyline doesn’t offer native gradient text styling, this workaround empowers you to elevate your visuals using SVG manipulation and JavaScript.
💻 The JavaScript Trigger to Apply Gradient Text
🔧 Step-by-Step Setup in Storyline
1. Find Your data-model-id
Just right-click your textbox in the Storyline preview and click the code shown—it’s automatically copied to your clipboard.
2. Add the Trigger in Storyline
-
Go to Triggers.
-
Create a new trigger with the action Execute JavaScript.
-
Paste the full JavaScript code above.
-
Set the trigger to run when the timeline starts.
🎨 Gradient Styling Explained
The key styling section is this part:
linearGradient.setAttribute('y1', '22%');
linearGradient.setAttribute(‘y2’, ‘82%’);
Why 22% to 82% instead of 0% to 100%? It aligns the gradient more naturally to the visual height of most fonts in Storyline’s SVG rendering. You can tweak these values to better match your text design.
The stops create hard color transitions to give it a more retro-rainbow effect. You can easily soften the gradient or change colors to match your theme.
⚠️ Key Considerations
-
✅ Works best on single-line text
-
✅ The text must be inside an SVG
-
❌ Won’t work on grouped shapes or multi-line text without adjustment
-
🌐 Test in Chrome, Edge, and Firefox for full compatibility
-
🧠 Keep accessibility in mind—consider high contrast and alt text
🚀 Bonus Enhancements
-
Animate it! Add subtle movement with CSS or GSAP.
-
Trigger on Interaction: Let the rainbow appear on click or hover.
-
Create Variations: Use gradients for alerts, correct answers, or badges.
🏁 Final Thoughts
Adding a rainbow gradient to text in Articulate Storyline is a bold way to stand out and show your design expertise. This tutorial gives you full control through JavaScript, unlocking styling possibilities not available through the native editor.
Experiment. Play. Celebrate diversity and inclusion through color.