Skip to content

Commit 8c1eeb8

Browse files
feat: unify overlay preview appearance
Place platform icons before nicknames and use white, checker, scene, and dark preview backdrops. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent bf21583 commit 8c1eeb8

22 files changed

Lines changed: 335 additions & 78 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,19 @@
66

77
## [Unreleased]
88

9-
### Исправлено
10-
11-
- Остров пресета на вкладке **Внешний вид** OBS: пресет, URL и статус в одной строке; URL укорочен с многоточием, копирование — иконкой (полный адрес в подсказке).
12-
- В окне OBS на вкладке **Внешний вид** поля и превью больше не обрезаются нижней панелью: список настроек прокручищается, кнопки «Закрыть» / «Сохранить» остаются на месте.
13-
- На вкладке **Внешний вид** выровнены поля при длинных подписях, поправлены отступы в блоке «Поверхность», кнопка «Убрать картинку» не выходит за границу, цвет и число в строках идут в одном порядке.
14-
- В теме **Default** маркеры платформы **Иконка** и **Полоска и иконка** снова показывают SVG-иконки в overlay и в превью.
15-
- Повторный выбор картинки панели в OBS-настройках снова срабатывает (поле файла сбрасывается после загрузки).
16-
- При отклонении картинки панели (формат, размер, HEIC/AVIF) админка показывает понятную ошибку вместо тихого сбоя.
17-
189
### Добавлено
1910

20-
- OBS-диалог: на **Подключении** в карточке Overlay снова поле URL (как у dock) и выбор пресета; на **Внешний вид** — остров пресета (селект + иконки новый / переименовать / дублировать / удалить, имя в отдельном окне), тема и очередь в одной колонке настроек.
21-
- В блоке **Поверхность** OBS-настроек: масштаб картинки панели (**заполнить / вписать / растянуть / плитка**) и привязка (**к сообщению / на колонку чата**; колонка — в теме Default); масштаб выбирается иконками с подсказкой при наведении.
22-
- В OBS-диалоге появились **пресеты внешнего вида** и URL overlay с `?preset=` для отдельного вида в каждой сцене.
11+
- **Пресеты внешнего вида** OBS overlay и URL с `?preset=` для отдельного вида в каждой сцене. На **Подключении** в карточке Overlay — поле URL и выбор пресета (как у dock); на **Внешний вид** — остров пресета (список, новый / переименовать / дублировать / удалить), тема и очередь в одной колонке.
12+
- В блоке **Поверхность**: картинка панели, масштаб (**заполнить / вписать / растянуть / плитка**) и привязка (**к сообщению / на колонку чата**; колонка — в теме Default); при отказе файла (формат, размер, HEIC/AVIF) показывается ошибка.
2313

24-
### Удалено
14+
### Изменено
2515

26-
- Вкладка **Выделения** в OBS-настройках: подсветка слов и список «своих» людей с иконками (будет переделано отдельно).
16+
- Превью OBS overlay: фоны **белый**, шахматка, **игровой кадр** и **чёрный** (вместо «загруженной сцены» и «тёмного»); в темах MW5 и G-Rebels фон заполняет весь прямоугольник. Старый адрес с `preview_background=busy` показывает игровой кадр.
17+
- Иконка платформы во всех темах стоит сразу перед ником; у новых пресетов **G-Rebels** она включена вместе с полоской (в уже сохранённых пресетах — «Сбросить группу к теме»).
2718

2819
### Миграция
2920

30-
- Старый `config.json` без `overlay.presets` при запуске превращается в пресет **Default** из текущих полей темы, лимита и TTL. Поля `overlay.highlights` и `overlay.people` игнорируются.
21+
- Старый `config.json` без `overlay.presets` при запуске превращается в пресет **Default** из текущих полей темы, лимита и TTL.
3122

3223
## [0.4.0] - 2026-08-22
3324

docs/FAQ.en.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ Quick renderer check without live chat:
5858
http://127.0.0.1:17877/overlay?preview=sample&preview_background=checker
5959
```
6060

61+
In the admin preview (**OBS → Appearance**) you can switch the backdrop: white, checkerboard, game footage, or black, to check contrast on bright and dark scenes. The legacy query `preview_background=busy` is treated as game footage.
62+
6163
To pin a look to an OBS scene, use a preset URL (copied on the **OBS → Setup** tab):
6264

6365
```
@@ -73,7 +75,7 @@ Sample messages should appear. The same mode exists in the admin panel: **OBS
7375
### Messages in admin but not in overlay (browser and OBS)
7476

7577
1. **Message TTL** — in **OBS → Appearance** set **0**, click **Save settings**. By default messages disappear after 20 seconds; old entries are not shown when opening the overlay.
76-
2. **Text only theme** — light text on a transparent background is almost invisible in a normal browser. For testing choose **Default** or open `?preview_background=dark`.
78+
2. **Text only theme** — light text on a transparent background is almost invisible in a normal browser. For testing choose **Default** or open `?preview_background=dark` (dark scene) or `?preview_background=white` (bright scene).
7779
3. **WebSocket** — at the bottom of the admin panel the **WS:** counter should be **2 or more** with `/overlay` open. In DevTools (F12) on the overlay tab check `ws://127.0.0.1:17877/ws`.
7880
4. **OBS cache** — after changing overlay settings: right-click the source → **Refresh cache of current page**.
7981
5. **URL and port** — copy the URL from **OBS → Setup**; if you changed the port in settings, update the Browser Source.

docs/FAQ.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ http://127.0.0.1:17877/overlay
5757
http://127.0.0.1:17877/overlay?preview=sample&preview_background=checker
5858
```
5959

60+
В превью админки (**OBS → Внешний вид**) фон можно сменить: белый, шахматка, игровой кадр или чёрный — так проверяют читаемость на ярком и тёмном кадре. Старый параметр `preview_background=busy` означает игровой кадр.
61+
6062
Чтобы закрепить вид за сценой OBS, используйте URL с пресетом (копируется на вкладке **OBS → Настройка**):
6163

6264
```
@@ -70,7 +72,7 @@ http://127.0.0.1:17877/overlay?preset=default
7072
### Сообщения есть в админке, но не в overlay (браузер и OBS)
7173

7274
1. **TTL сообщения** (Message TTL) — в **OBS → Внешний вид** (Appearance) выставьте **0**, нажмите **Сохранить настройки** (Save settings). По умолчанию сообщения исчезают через 20 секунд; старые записи при открытии overlay не показываются.
73-
2. **Тема Text only (без фона)** — светлый текст на прозрачном фоне в обычном браузере почти не виден. Для проверки выберите **Default** или откройте `?preview_background=dark`.
75+
2. **Тема Text only (без фона)** — светлый текст на прозрачном фоне в обычном браузере почти не виден. Для проверки выберите **Default** или откройте `?preview_background=dark` (тёмный кадр) либо `?preview_background=white` (яркий).
7476
3. **WebSocket** — внизу админки счётчик **WS:** при открытой вкладке `/overlay` должен быть **2 или больше**. В DevTools (F12) на вкладке overlay проверьте соединение `ws://127.0.0.1:17877/ws`.
7577
4. **Кэш OBS** — после смены настроек overlay: правый клик по источнику → **Refresh cache of current page**.
7678
5. **URL и порт** — копируйте URL из **OBS → Настройка** (Setup); при смене порта в настройках обновите Browser Source.

internal/config/overlay_config_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ func TestLoad_WhenLegacyOverlayJSON_ExpectMigratedPreset(t *testing.T) {
106106
require.Equal(t, OverlayPlatformMarkerIcon, cfg.Overlay.Presets[0].Style.PlatformMarker)
107107
}
108108

109+
func TestDefaultOverlayStyleForTheme_WhenGRebelsPopups_ExpectBothPlatformMarker(t *testing.T) {
110+
t.Parallel()
111+
112+
style := defaultOverlayStyleForTheme(OverlayThemeGRebelsPopups)
113+
require.Equal(t, OverlayPlatformMarkerBoth, style.PlatformMarker)
114+
require.InDelta(t, 0.0, style.PanelOpacity, 0.001)
115+
}
116+
109117
func TestDefault_WhenCalled_ExpectPresetMirrorsFlatFields(t *testing.T) {
110118
t.Parallel()
111119

internal/config/overlay_style.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ func defaultOverlayStyleForTheme(theme string) OverlayStyleConfig {
9292
style.PlatformMarker = OverlayPlatformMarkerIcon
9393
style.PanelOpacity = 0
9494
style.TextEdge = OverlayTextEdgeOutline
95-
case OverlayThemeCockpitPanel, OverlayThemeGRebelsPopups:
95+
case OverlayThemeCockpitPanel:
9696
style.PanelOpacity = 0
97-
case OverlayThemeCockpitPopups:
97+
case OverlayThemeCockpitPopups, OverlayThemeGRebelsPopups:
9898
style.PlatformMarker = OverlayPlatformMarkerBoth
9999
style.PanelOpacity = 0
100100
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
schema: spec-driven
2+
created: 2026-08-25
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
## Context
2+
3+
See proposal.md for motivation. Overlay messages already have `.message__identity` (flex) and a `.message__platform` sibling. HUD themes use CSS grid without a platform area, so the icon auto-places under the avatar. Preview backdrops are body classes `overlay-preview--busy|checker|dark`. Admin already imports `web/overlay/overlay-settings.js`.
4+
5+
## Goals / Non-Goals
6+
7+
**Goals:**
8+
9+
- One identity slot for the platform icon across themes
10+
- Shared preview backdrop vocabulary and query values
11+
- Theme defaults that match G-Rebels platform-identity need (`both`)
12+
13+
**Non-Goals:**
14+
15+
- Uploading a real OBS scene screenshot
16+
- Gray fifth backdrop
17+
- Migrating existing G-Rebels presets that already saved `stripe`
18+
- Changing platform-marker semantics (stripe vs author rail)
19+
- Making cockpit-panel glass transparent in preview so footage always shows through
20+
21+
## Decisions
22+
23+
### Identity owns the icon
24+
25+
**Choice:** Append `.message__platform` inside `.message__identity` before `.message__user`.
26+
27+
**Rationale:** Identity already has `grid-area: user` in HUD themes and `inline-flex` + gap. Moving the node fixes placement without a new grid track.
28+
29+
**Alternatives:** Avatar-corner badge (clips on G-Rebels chamfer); extra grid column (duplicates identity).
30+
31+
### Canonical preview values
32+
33+
**Choice:** Canonical values `white`, `checker`, `scene`, `dark`. Alias `busy``scene`. Default `scene`. Shared `normalizePreviewBackground` in `overlay-settings.js`.
34+
35+
**Rationale:** `dark` stays as the query value (FAQ already uses it); labels become Black / Чёрный. Keep `scene` as the honest name instead of `busy`.
36+
37+
**Alternatives:** Rename `dark` to `black` (breaks FAQ URLs); keep `busy` as canonical (labels stay confusing).
38+
39+
### Backdrop lives on overlay `body`
40+
41+
**Choice:** Continue painting preview CSS on overlay `body`. Themes that cover the rectangle with HUD glass still hide footage there — that matches OBS.
42+
43+
**Alternatives:** Letterbox the scene around the iframe in admin chrome (preview-only lie); force HUD panel transparent in preview (dishonest).
44+
45+
### G-Rebels default `both`
46+
47+
**Choice:** `defaultOverlayStyleForTheme` / `defaultStyleForTheme` for `g_rebels_popups` use `both`, like `cockpit_popups`. No rewrite of stored preset style.
48+
49+
**Rationale:** G-Rebels nicknames are gold, so the icon is the platform signal. Existing saved `stripe` remains an explicit operator choice.
50+
51+
## Risks / Trade-offs
52+
53+
- [Existing G-Rebels presets stay without icons] → Changelog points at "Reset group to theme"
54+
- [Cockpit panel name column is `fit-content(18ch)`] → Icon is `flex-shrink: 0`; name keeps ellipsis
55+
- [Cached overlay CSS/JS] → Bump `?v=` on overlay assets
56+
57+
## Migration Plan
58+
59+
- New installs and new G-Rebels presets get `both`
60+
- `preview_background=busy` and localStorage `busy` map to `scene`
61+
- Rollback: revert overlay DOM/CSS and restore the three-value select; alias keeps old URLs working during the change only
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## Why
2+
3+
OBS overlay preview appearance is inconsistent across themes: platform icons in HUD themes fall under the avatar instead of sitting with the nickname, G-Rebels hides platform identity by default, and preview backgrounds mix a mistranslated "busy/loaded scene" with an incomplete contrast set (no white). Streamers cannot compare themes or judge readability against bright gameplay.
4+
5+
## What Changes
6+
7+
- Place the platform icon inside the message identity, immediately before the display name, in every theme when the platform marker is `icon` or `both`.
8+
- Default G-Rebels Cockpit popups to `both` (author rail + platform icon), matching MW5 Cockpit popups. Cockpit panel stays `stripe`.
9+
- Unify preview backgrounds to four options, same CSS on `body` for every theme: white, checkerboard, game footage (`scene`, replacing `busy`), black (`dark`).
10+
- Accept legacy `preview_background=busy` as `scene`. Preview still only paints transparent regions; HUD glass may cover the footage.
11+
- Rename admin labels: "Загруженная сцена" / "Busy scene" → "Игровой кадр" / "Game footage"; "Тёмный" / "Dark" → "Чёрный" / "Black".
12+
13+
## Capabilities
14+
15+
### New Capabilities
16+
17+
- None
18+
19+
### Modified Capabilities
20+
21+
- `obs-overlay`: platform icon placement; G-Rebels default marker; preview background query values
22+
- `admin-and-dock`: appearance preview background control and labels
23+
24+
## Impact
25+
26+
- Overlay DOM/CSS (`web/overlay`), admin preview select (`web/admin`), i18n catalogs, overlay-settings defaults (JS + Go `defaultOverlayStyleForTheme`)
27+
- Query param `preview_background`; localStorage preview preference maps `busy``scene`
28+
- FAQ overlay test URLs; CHANGELOG `[Unreleased]`
29+
- Existing G-Rebels presets that already saved `stripe` keep that value until the operator resets the marker group to the theme default
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## ADDED Requirements
2+
3+
### Requirement: Appearance preview offers a shared backdrop set
4+
The OBS Appearance preview SHALL let the operator choose a backdrop from white, checkerboard, game footage, and black. Labels MUST describe contrast purpose (not an uploaded OBS scene). The preview iframe MUST pass the matching `preview_background` query value. Stored preference `busy` MUST map to game footage.
5+
6+
#### Scenario: Backdrop options
7+
- **WHEN** the operator opens the overlay appearance preview background control
8+
- **THEN** the options are white, checkerboard, game footage, and black, in that order
9+
10+
#### Scenario: Restored busy preference
11+
- **WHEN** a previously stored preview background value is `busy`
12+
- **THEN** the control shows game footage and the iframe uses `preview_background=scene`
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## ADDED Requirements
2+
3+
### Requirement: Platform icon sits with the display name
4+
When the platform marker is `icon` or `both`, the overlay SHALL render the platform icon immediately before the display name inside the message identity, in every supported theme. The icon MUST NOT occupy a leftover grid cell (for example under the avatar) in HUD themes.
5+
6+
#### Scenario: HUD popup with icon marker
7+
- **WHEN** the theme is `cockpit_popups` or `g_rebels_popups` and the platform marker is `icon` or `both`
8+
- **THEN** the platform icon appears on the same row as the display name, immediately before it
9+
10+
#### Scenario: Stripe hides the icon
11+
- **WHEN** the platform marker is `stripe` or `none`
12+
- **THEN** the platform icon is not shown
13+
14+
### Requirement: G-Rebels default platform marker includes the icon
15+
New presets and theme-default style for `g_rebels_popups` SHALL use platform marker `both`. Existing presets that already stored a marker MUST keep that stored value.
16+
17+
#### Scenario: New G-Rebels preset
18+
- **WHEN** the operator creates a preset with theme `g_rebels_popups` without overriding the platform marker
19+
- **THEN** the marker is `both`
20+
21+
### Requirement: Preview backgrounds are a shared contrast set
22+
When `/overlay` is loaded with a preview query, `preview_background` SHALL apply the same page backdrop for every theme: `white`, `checker`, `scene`, or `dark`. Legacy value `busy` SHALL be treated as `scene`. Missing or invalid values SHALL use `scene`. Outside preview, `html` and `body` backgrounds MUST remain transparent. Theme chrome MAY still cover parts of the backdrop.
23+
24+
#### Scenario: White preview backdrop
25+
- **WHEN** the overlay URL includes a preview flag and `preview_background=white`
26+
- **THEN** the page backdrop is solid white behind transparent overlay regions
27+
28+
#### Scenario: Legacy busy query
29+
- **WHEN** the overlay URL includes a preview flag and `preview_background=busy`
30+
- **THEN** the page backdrop is the same game-footage pattern as `scene`
31+
32+
#### Scenario: HUD theme preview fills the rectangle
33+
- **WHEN** the theme is `cockpit_popups` or `g_rebels_popups` and preview uses `preview_background=scene`
34+
- **THEN** the game-footage backdrop fills the Browser Source rectangle behind transparent HUD regions rather than the browser default white page
35+
36+
#### Scenario: Live OBS overlay
37+
- **WHEN** `/overlay` loads without a preview query
38+
- **THEN** the page background stays transparent

0 commit comments

Comments
 (0)