openvibers/openvibe.design Commits

The LIVE badge reads on its white text (#111)

OP OpenVibers committed 12 days ago · d663d626f3 · 2 files, +16 −1

Changes

ddiff --git a/public/css/design.css b/public/css/design.css
iindex de16f6b..3bf24bf 100644
---- a/public/css/design.css
++++ b/public/css/design.css
@@@ -62,7 +62,7 @@ html, body { margin: 0; background: var(--bg-primary, #0a0f1c); color: var(--tex
.pv-frame { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 16px; background: var(--bg-primary); color: var(--text-primary); border: 1px solid var(--border); min-width: 0; font-size: .86rem; }
.pv-label { margin: 0; font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.pv-video { position: relative; aspect-ratio: 16 / 8; border-radius: 12px; background: radial-gradient(120% 120% at 70% 30%, color-mix(in srgb, var(--accent) 40%, transparent), transparent 60%), linear-gradient(160deg, var(--bg-tertiary, var(--bg-card)), var(--bg-card)); }
--.pv-badge { position: absolute; left: 8px; top: 8px; padding: 1px 7px; border-radius: 5px; background: var(--live-red, #e11d48); color: #fff; font-size: .68rem; font-weight: 800; }
++.pv-badge { position: absolute; left: 8px; top: 8px; padding: 1px 7px; border-radius: 5px; background: color-mix(in srgb, var(--live-red, #e11d48) 80%, #000); color: #fff; font-size: .68rem; font-weight: 800; }
.pv-viewers { position: absolute; right: 8px; bottom: 8px; padding: 1px 7px; border-radius: 5px; background: rgba(0, 0, 0, .6); color: #fff; font-size: .7rem; font-weight: 700; }
.pv-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pv-col { display: flex; flex-direction: column; min-width: 0; flex: 1; }
ddiff --git a/test/contrast.test.js b/test/contrast.test.js
nnew file mode 100644
iindex 0000000..91983a5
---- /dev/null
++++ b/test/contrast.test.js
@@@ -0,0 +1,15 @@
++'use strict';
++// WCAG 2.1 AA: the preview's LIVE badge was white on the live red (3.8:1). The red is now 80% over black,
++// which keeps the badge red and lifts the white text.
++// node test/contrast.test.js
++const assert = require('assert');
++const fs = require('fs');
++const path = require('path');
++
++const css = fs.readFileSync(path.join(__dirname, '..', 'public', 'css', 'design.css'), 'utf8');
++assert.ok(
++ css.includes('background: color-mix(in srgb, var(--live-red, #e11d48) 80%, #000); color: #fff; font-size: .68rem; font-weight: 800; }'),
++ 'the LIVE badge darkens its red under white text'
++);
++assert.ok(!css.includes('.pv-badge { position: absolute; left: 8px; top: 8px; padding: 1px 7px; border-radius: 5px; background: var(--live-red, #e11d48);'), 'the plain live red is gone from the badge');
++console.log('contrast: the LIVE badge reads');