Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

fix(theme): repair chat user color tokens in theme source

Gabe Kangas3451ac5e44ec
diff --git a/web/style-definitions/tokens/color/default-theme.yaml b/web/style-definitions/tokens/color/default-theme.yaml
index 8c523dec24..d4c00a24da 100644
--- a/web/style-definitions/tokens/color/default-theme.yaml
+++ b/web/style-definitions/tokens/color/default-theme.yaml
@@ -5,7 +5,7 @@
theme:
rounded-corners:
- value: 5px
+ value: 9px
comment: 'How much corners are rounded in places in the UI.'
unknown-1:
value: 'green'
@@ -36,7 +36,7 @@ theme:
5:
value: 'var(--color-owncast-user-5)'
6:
- value: 'var(--color-owncast-user-6)'
+ value: 'var(--color-owncast-user-6)'
7:
value: 'var(--color-owncast-user-7)'
diff --git a/web/tests/themeVariables.test.ts b/web/tests/themeVariables.test.ts
new file mode 100644
index 0000000000..d5bc2b75d6
--- /dev/null
+++ b/web/tests/themeVariables.test.ts
@@ -0,0 +1,29 @@
+import fs from 'fs';
+import path from 'path';
+
+// Guards against regressions in the generated theme variables that ship in
+// styles/variables.css. The token source (style-definitions) is the source of
+// truth, but variables.css is the artifact the app actually loads, so we assert
+// against it directly.
+
+const variablesCssPath = path.join(__dirname, '..', 'styles', 'variables.css');
+const css = fs.readFileSync(variablesCssPath, 'utf8');
+
+describe('generated theme variables', () => {
+ // A YAML indentation bug in the token source once collapsed the eight
+ // per-user chat colors (--theme-color-users-0..7) into a single broken
+ // --theme-color-users variable. That breaks chat username colors and the
+ // admin "Chat User Colors" pickers (which reference theme-color-users-0..7).
+ test('declares all eight distinct chat user colors', () => {
+ for (let i = 0; i < 8; i += 1) {
+ const declaration = `--theme-color-users-${i}: var(--color-owncast-user-${i});`;
+ expect(css).toContain(declaration);
+ }
+ });
+
+ test('does not declare a collapsed --theme-color-users variable', () => {
+ // The trailing colon distinguishes the broken collapsed variable from the
+ // valid indexed ones (--theme-color-users-0, etc.).
+ expect(css).not.toMatch(/--theme-color-users:/);
+ });
+});