MorphCanvas
HomeGallery › Gradient Generator Card

Gradient Generator Card

A compact, accessible gradient generator with two color inputs and live preview on a dark background.

★ 0 community votes · Safety scan passed · Sandboxed preview

About this component

Gradient Generator Card is an interface component generated on MorphCanvas, an infinite AI workspace that turns written intent into reviewable HTML, CSS, and JavaScript widgets. This component passed MorphCanvas’s automated safety scan, which checks for unsafe patterns such as external network calls, storage access, inline event handlers, and code execution, and it is rendered here inside a sandboxed preview frame.

How it was built

A creator described the result they wanted, MorphCanvas routed the request through its AI provider chain with automatic failover, scanned the generated code, and published the reviewed component to the public library. You can build and publish your own components on the MorphCanvas canvas.

Source

HTML

<div class="gradient-card"><h3>Gradient Generator</h3><div class="inputs"><label for="color1">Color 1</label><input type="color" id="color1" value="#ff0000"><label for="color2">Color 2</label><input type="color" id="color2" value="#0000ff"></div><div id="preview" class="preview"></div></div>

CSS

.gradient-card{background:#2e2e2e;color:#fff;padding:20px;border-radius:8px;max-width:300px;font-family:sans-serif}.gradient-card h3{margin-top:0}.gradient-card .inputs{display:flex;gap:10px;align-items:center;margin-top:10px}.gradient-card .inputs label{font-size:0.9rem}.gradient-card .inputs input{width:40px;height:30px;border:none;padding:0;background:none}.gradient-card .preview{height:150px;border-radius:6px;margin-top:15px;background:linear-gradient(to right,#ff0000,#0000ff)}

JavaScript

document.addEventListener('DOMContentLoaded',()=>{const c1=document.getElementById('color1'),c2=document.getElementById('color2'),p=document.getElementById('preview');const update=()=>{p.style.background=`linear-gradient(to right,${c1.value},${c2.value})`};c1.addEventListener('input',update);c2.addEventListener('input',update);update();});
Build your own on MorphCanvas