Neon Tube Glow
A neon sign built from layered text shadows, with three colours, a power slider and an optional flicker.
AI prompt
Night photograph of a pink neon sign reading OPEN mounted on a dark red brick wall, the glass tubes glowing with a bright white-hot core fading to saturated magenta and a soft wide halo spilling onto the bricks, small black wire supports behind the letters, subtle reflection on a rain-wet pavement below, 35mm lens, shallow depth of field, retro and moody. Variants: cyan blue tubes and warm amber tubes, with one letter slightly dimmer as if failing. Negative: flat colour text, daylight, overexposed haze, text errors, logos. Reduced motion: static image.About this pattern
Definition
A neon sign is a glowing glass tube. In CSS you can fake it with a bright, nearly white core, a coloured inner glow and a wide soft halo, all from layered text-shadow. A dark brick wall behind it makes the colour read as light rather than paint.
Purpose & UX principles
- The text colour is near white; the colour comes from stacked shadows around it.
- Use three to five shadows: tight and bright, then progressively wider and fainter.
- Dark backgrounds are essential; the glow disappears on light ones.
- A short flicker on one letter sells the broken-tube charm.
Interaction states
- Three colours, a Power slider and a Flicker switch.
Motion specification
- The flicker lasts a fraction of a second and repeats every few seconds.
- Reduced motion: the flicker switch is disabled and the sign stays steady.
Responsive behaviour
- Keep flicker slow and brief; rapid flashing can trigger photosensitive reactions.
- Do not rely on the glow alone for text contrast: the core stays light.
Code
<div class="bx"><div class="pre" id="pre" role="group" aria-label="Colour"><button data-p="0" aria-pressed="true">Pink</button><button data-p="1" aria-pressed="false">Cyan</button><button data-p="2" aria-pressed="false">Amber</button></div><div class="wl" id="wl"><span class="nn" id="nn"><i>O</i><i>P</i><i id="fl">E</i><i>N</i></span></div><div class="two"><label class="rw">Power <b id="pv">80%</b><input id="pw" type="range" min="10" max="100" value="80"></label><label class="sw"><input id="fk" type="checkbox"> Flicker</label></div></div>:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}a{color:inherit;text-decoration:none}ul,ol,p,h4{margin:0;padding:0}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.pre{display:flex;gap:5px;flex-wrap:wrap}.pre button{height:28px;padding:0 11px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:11px;cursor:pointer}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.bx{width:min(330px,100%);display:grid;gap:9px}.rw{display:grid;gap:3px;font-size:11.5px;color:var(--muted)}.rw b{color:var(--text);font-weight:600}input[type=range]{width:100%;accent-color:#171717}
.out{font-size:12px;color:var(--muted);line-height:1.4}.out b{color:var(--text)}
button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.wl{height:120px;border-radius:12px;display:grid;place-items:center;background:repeating-linear-gradient(0deg,#2b1614 0 14px,#1c0f0e 14px 16px),repeating-linear-gradient(90deg,transparent 0 30px,rgba(0,0,0,.35) 30px 32px);background-color:#241210}.nn{display:flex;gap:6px;font:700 40px/1 system-ui,sans-serif;letter-spacing:.06em}.nn i{font-style:normal;color:#fff;text-shadow:0 0 calc(2px*var(--p)) #fff,0 0 calc(7px*var(--p)) var(--c),0 0 calc(16px*var(--p)) var(--c),0 0 calc(34px*var(--p)) var(--c),0 0 calc(60px*var(--p)) var(--c)}.nn i.off{color:rgba(255,255,255,.35);text-shadow:none}.two{display:grid;grid-template-columns:1fr 1fr;gap:12px}.sw{display:flex;gap:6px;align-items:center;font-size:12px;color:var(--muted)}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}const C=['#ff2fa8','#1ad8ff','#ffa51f'],nn=document.getElementById('nn'),pw=document.getElementById('pw'),fk=document.getElementById('fk'),fl=document.getElementById('fl'),bs=[...document.querySelectorAll('#pre button')],calm=matchMedia('(prefers-reduced-motion:reduce)').matches;let p=0,tm=null;if(calm)fk.disabled=true;
function up(){nn.style.setProperty('--c',C[p]);nn.style.setProperty('--p',(pw.value/100*1.1).toFixed(2));document.getElementById('pv').textContent=pw.value+'%';bs.forEach(b=>b.setAttribute('aria-pressed',String(+b.dataset.p===p)));}
function flick(){let n=0;const seq=[1,0,1,0,0,1,1];const id=setInterval(()=>{fl.classList.toggle('off',seq[n]===0);n++;if(n>=seq.length){clearInterval(id);fl.classList.remove('off');}},90);}
fk.addEventListener('change',()=>{clearInterval(tm);fl.classList.remove('off');if(fk.checked&&!calm){flick();tm=setInterval(flick,3200);}});
bs.forEach(b=>b.addEventListener('click',()=>{p=+b.dataset.p;up();}));pw.addEventListener('input',up);up();One complete HTML file. Save it and open it in a browser.
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Neon Tube Glow — demo</title>
<style>
:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
html,body{height:100%}body{background:var(--bg);color:var(--text);font:15px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Inter,Roboto,sans-serif;-webkit-font-smoothing:antialiased}.stage{min-height:100%;display:grid;place-items:center;padding:24px}button,input,select,textarea{font-family:inherit}@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}a{color:inherit;text-decoration:none}ul,ol,p,h4{margin:0;padding:0}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.pre{display:flex;gap:5px;flex-wrap:wrap}.pre button{height:28px;padding:0 11px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:11px;cursor:pointer}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.bx{width:min(330px,100%);display:grid;gap:9px}.rw{display:grid;gap:3px;font-size:11.5px;color:var(--muted)}.rw b{color:var(--text);font-weight:600}input[type=range]{width:100%;accent-color:#171717}
.out{font-size:12px;color:var(--muted);line-height:1.4}.out b{color:var(--text)}
button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.wl{height:120px;border-radius:12px;display:grid;place-items:center;background:repeating-linear-gradient(0deg,#2b1614 0 14px,#1c0f0e 14px 16px),repeating-linear-gradient(90deg,transparent 0 30px,rgba(0,0,0,.35) 30px 32px);background-color:#241210}.nn{display:flex;gap:6px;font:700 40px/1 system-ui,sans-serif;letter-spacing:.06em}.nn i{font-style:normal;color:#fff;text-shadow:0 0 calc(2px*var(--p)) #fff,0 0 calc(7px*var(--p)) var(--c),0 0 calc(16px*var(--p)) var(--c),0 0 calc(34px*var(--p)) var(--c),0 0 calc(60px*var(--p)) var(--c)}.nn i.off{color:rgba(255,255,255,.35);text-shadow:none}.two{display:grid;grid-template-columns:1fr 1fr;gap:12px}.sw{display:flex;gap:6px;align-items:center;font-size:12px;color:var(--muted)}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
</style></head>
<body><div class="stage">
<div class="bx"><div class="pre" id="pre" role="group" aria-label="Colour"><button data-p="0" aria-pressed="true">Pink</button><button data-p="1" aria-pressed="false">Cyan</button><button data-p="2" aria-pressed="false">Amber</button></div><div class="wl" id="wl"><span class="nn" id="nn"><i>O</i><i>P</i><i id="fl">E</i><i>N</i></span></div><div class="two"><label class="rw">Power <b id="pv">80%</b><input id="pw" type="range" min="10" max="100" value="80"></label><label class="sw"><input id="fk" type="checkbox"> Flicker</label></div></div>
</div>
<script>
const C=['#ff2fa8','#1ad8ff','#ffa51f'],nn=document.getElementById('nn'),pw=document.getElementById('pw'),fk=document.getElementById('fk'),fl=document.getElementById('fl'),bs=[...document.querySelectorAll('#pre button')],calm=matchMedia('(prefers-reduced-motion:reduce)').matches;let p=0,tm=null;if(calm)fk.disabled=true;
function up(){nn.style.setProperty('--c',C[p]);nn.style.setProperty('--p',(pw.value/100*1.1).toFixed(2));document.getElementById('pv').textContent=pw.value+'%';bs.forEach(b=>b.setAttribute('aria-pressed',String(+b.dataset.p===p)));}
function flick(){let n=0;const seq=[1,0,1,0,0,1,1];const id=setInterval(()=>{fl.classList.toggle('off',seq[n]===0);n++;if(n>=seq.length){clearInterval(id);fl.classList.remove('off');}},90);}
fk.addEventListener('change',()=>{clearInterval(tm);fl.classList.remove('off');if(fk.checked&&!calm){flick();tm=setInterval(flick,3200);}});
bs.forEach(b=>b.addEventListener('click',()=>{p=+b.dataset.p;up();}));pw.addEventListener('input',up);up();
</script>
</body></html>