fix(0.3.1): My Radio layout polish + drop dark-auto

Real-screen review of v0.3.0 surfaced a contrast bug and several layout
issues. Quick patch.

- Drop @media prefers-color-scheme dark for theme=auto. WP admin has
  no native dark mode, so OS-dark made our light text sit on the still-
  white WP postbox = unreadable. `auto` now behaves as light; `dark`
  remains as an explicit choice.
- theme=dark now actually reads: the player surface itself goes dark
  (#1d2327 bg + subtle border + padding) so the light text has somewhere
  to land instead of fighting the white WP postbox.
- .radio-wrap max-width 880px — player no longer stretches edge-to-edge.
- Drop the .radio-intro max-width:720px cap so the intro fits one line.
- Volume slider fixed at flex:0 0 auto / width:220px — % label sits next
  to the slider instead of pinned to the far edge.
- Station dropdown capped at 360px (was width:100%).
- Play-button dashicon shrunk 18px → 14px so it sits on the button-text
  baseline instead of looking like a second row.

Files: radio.php, assets/css/radio.css, inc/about.php, CHANGELOG.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-29 23:11:06 +01:00
parent c5a4b28b29
commit 774e7f9958
4 changed files with 46 additions and 35 deletions
+17
View File
@@ -9,6 +9,23 @@ Format: [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/) — versi
--- ---
## [0.3.1] — 2026-05-29 — My Radio layout polish + drop dark-auto
Quick patch after a real-screen review of the My Radio admin page. v0.3.0 added a lot of features but stretched the player to fill the full admin width and — embarrassingly — introduced a real contrast bug via the dark-auto CSS.
### Fixed
- **Dropped `@media (prefers-color-scheme: dark)` for `theme=auto`.** WordPress admin has no native dark mode, so when the OS was dark, our dark text rendered on the still-white WP postbox = unreadable. `auto` now behaves as light (matching WP's actual scheme); `dark` is still available as an explicit choice.
- **`theme=dark` now actually reads.** The player surface goes dark (`#1d2327` background + subtle border + padding) so the light text has somewhere to sit, instead of fighting the white WP postbox.
- **Player no longer stretches edge-to-edge.** `.radio-wrap { max-width: 880px; }` keeps the player a focused settings-page card.
- **Intro paragraph one-line on normal widths.** Removed the `max-width: 720px` cap that was forcing the wrap.
- **Volume slider no longer dominates the row.** Fixed width 220px (`flex: 0 0 auto`) — the percent label now sits next to the slider instead of pinned to the far right edge.
- **Station dropdown** capped at 360px (was full-width) — typical WP form-control width.
- **Play button icon** shrunk from 18px to 14px so the ▶ glyph sits on the button-text baseline instead of looking like a separate row.
**Files changed:** `radio.php` (version), `assets/css/radio.css` (wrap width, intro, play icon, volume, station-select, dark-auto block deleted, dark-surface added), `inc/about.php` (history entry).
---
## [0.3.0] — 2026-05-29 — Dark theme + mute + media keys + current-track display ## [0.3.0] — 2026-05-29 — Dark theme + mute + media keys + current-track display
A polish pass that closes the gaps surfaced by a UI review. Two categories: **2nd-look fixes** (things the previous release implied but didn't actually deliver) and **nice-to-haves** (small upgrades that lift the admin-player feel). A polish pass that closes the gaps surfaced by a UI review. Two categories: **2nd-look fixes** (things the previous release implied but didn't actually deliver) and **nice-to-haves** (small upgrades that lift the admin-player feel).
+21 -31
View File
@@ -87,9 +87,9 @@
} }
.radio-player__play .dashicons { .radio-player__play .dashicons {
font-size: 18px; font-size: 14px;
width: 18px; width: 14px;
height: 18px; height: 14px;
line-height: 1; line-height: 1;
} }
@@ -97,8 +97,8 @@
display: flex; display: flex;
align-items: center; align-items: center;
gap: 8px; gap: 8px;
flex: 1; flex: 0 0 auto;
min-width: 200px; width: 220px;
} }
.radio-player__volume .dashicons { .radio-player__volume .dashicons {
@@ -160,7 +160,7 @@
.radio-player__station-select select { .radio-player__station-select select {
width: 100%; width: 100%;
max-width: 100%; max-width: 360px;
} }
/* Error notice — uses WP notice styling */ /* Error notice — uses WP notice styling */
@@ -195,9 +195,15 @@
} }
/* ────────────────────────────────────────────────────────────────── /* ──────────────────────────────────────────────────────────────────
* Main admin page — wrap player in a postbox-like card * Main admin page — wrap player in a postbox-like card.
* Constrained max-width keeps the player a focused settings-page card
* instead of stretching to fill the full admin width.
* ─────────────────────────────────────────────────────────────── */ * ─────────────────────────────────────────────────────────────── */
.radio-wrap {
max-width: 880px;
}
.radio-wrap .radio-player { .radio-wrap .radio-player {
margin-top: 4px; margin-top: 4px;
} }
@@ -206,7 +212,6 @@
margin: 0 0 16px; margin: 0 0 16px;
color: #50575e; color: #50575e;
font-size: 13px; font-size: 13px;
max-width: 720px;
} }
/* ────────────────────────────────────────────────────────────────── /* ──────────────────────────────────────────────────────────────────
@@ -366,27 +371,12 @@
border-top-color: #3c434a; border-top-color: #3c434a;
} }
/* Auto — same dark rules behind prefers-color-scheme. Duplicated rather /* Give the player its own dark surface when theme=dark so the dark text
than nested in @media-inside-selector (CSS doesn't allow that), kept has something to read against — WP postboxes don't follow our dark
line-for-line in sync with the .radio-theme-dark block above. */ choice, so without this the light text would sit on white. */
@media (prefers-color-scheme: dark) { .radio-theme-dark .radio-player {
.radio-theme-auto .radio-player__now { border-bottom-color: #3c434a; } background: #1d2327;
.radio-theme-auto .radio-player__station-name { color: #f0f0f1; } padding: 14px 16px;
.radio-theme-auto .radio-player__label, border-radius: 3px;
.radio-theme-auto .radio-player__station-genre, border: 1px solid #3c434a;
.radio-theme-auto .radio-player__volume-pct,
.radio-theme-auto .radio-player__credit,
.radio-theme-auto .radio-player__mute,
.radio-theme-auto .radio-player__station-select label,
.radio-theme-auto .radio-player__volume .dashicons { color: #a7aaad; }
.radio-theme-auto .radio-player__mute:hover { color: #f0f0f1; }
.radio-theme-auto .radio-player__mute--muted { color: #ff8b8b; }
.radio-theme-auto .radio-player__station-desc,
.radio-theme-auto .radio-player__track,
.radio-theme-auto .radio-intro { color: #c3c4c7; }
.radio-theme-auto .radio-player__station-genre { background: rgba(255, 255, 255, 0.08); }
.radio-theme-auto .radio-player__error { background: rgba(179, 45, 46, 0.18); color: #ff9b9b; }
.radio-theme-auto .radio-about-card { background: #1d2327; border-color: #3c434a; color: #c3c4c7; }
.radio-theme-auto .radio-about-card h2 { background: #2c3338; color: #f0f0f1; border-bottom-color: #3c434a; }
.radio-theme-auto #radio_dashboard_widget .radio-player__credit { border-top-color: #3c434a; }
} }
+6 -2
View File
@@ -48,8 +48,12 @@ function radio_render_about_page() {
<h2><?php esc_html_e( 'Version history', 'radio' ); ?></h2> <h2><?php esc_html_e( 'Version history', 'radio' ); ?></h2>
<ul> <ul>
<li> <li>
<span class="ver">v0.3.0</span> &mdash; 29 May 2026 <span class="latest">latest</span><br> <span class="ver">v0.3.1</span> &mdash; 29 May 2026 <span class="latest">latest</span><br>
<?php esc_html_e( 'Dark theme actually wired through (auto / light / darkauto follows OS prefers-color-scheme). Mute toggle on the speaker icon. OS media keys (F8 / headphone buttons / lock-screen) play and pause via MediaSession. Current track polled from SomaFM and shown under the station description while playing. Save errors surface as a brief notice instead of being swallowed. Genre badge restyled as an inline pill.', 'radio' ); ?> <?php esc_html_e( 'My Radio layout polish + dropped dark-auto. Player no longer stretches edge-to-edge (max-width 880px); volume slider fixed width so the % label sits next to it; station dropdown capped at 360px; play-button icon shrunk to match the button text baseline; intro paragraph now fits one line. Removed the prefers-color-scheme dark-auto behaviour that was unreadable against WordPress\'s still-white postbox; theme=dark is still available as an explicit choice and now gives the player its own dark surface so it actually reads.', 'radio' ); ?>
</li>
<li>
<span class="ver">v0.3.0</span> &mdash; 29 May 2026<br>
<?php esc_html_e( 'Dark theme wired through. Mute toggle on the speaker icon. OS media keys (F8 / headphone buttons / lock-screen) play and pause via MediaSession. Current track polled from SomaFM and shown under the station description while playing. Save errors surface as a brief notice instead of being swallowed. Genre badge restyled as an inline pill.', 'radio' ); ?>
</li> </li>
<li> <li>
<span class="ver">v0.2.0</span> &mdash; 26 May 2026<br> <span class="ver">v0.2.0</span> &mdash; 26 May 2026<br>
+2 -2
View File
@@ -5,7 +5,7 @@
* Plugin Name: Radio * Plugin Name: Radio
* Plugin URI: https://icanhelp.ie/radio * Plugin URI: https://icanhelp.ie/radio
* Description: A small, focused, free radio player for your WordPress admin. 44 SomaFM stations grouped by 10 genres — ambient, electronic, lounge, rock, metal, jazz, world, reggae, holiday, specials. Plays via HTML5 audio; volume + station choice persist per-user. * Description: A small, focused, free radio player for your WordPress admin. 44 SomaFM stations grouped by 10 genres — ambient, electronic, lounge, rock, metal, jazz, world, reggae, holiday, specials. Plays via HTML5 audio; volume + station choice persist per-user.
* Version: 0.3.0 * Version: 0.3.1
* Requires at least: 5.0 * Requires at least: 5.0
* Requires PHP: 7.4 * Requires PHP: 7.4
* Author: David Keane * Author: David Keane
@@ -20,7 +20,7 @@
if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! defined( 'ABSPATH' ) ) { exit; }
// Plugin coordinates. // Plugin coordinates.
if ( ! defined( 'RADIO_VERSION' ) ) { define( 'RADIO_VERSION', '0.3.0' ); } if ( ! defined( 'RADIO_VERSION' ) ) { define( 'RADIO_VERSION', '0.3.1' ); }
if ( ! defined( 'RADIO_FILE' ) ) { define( 'RADIO_FILE', __FILE__ ); } if ( ! defined( 'RADIO_FILE' ) ) { define( 'RADIO_FILE', __FILE__ ); }
if ( ! defined( 'RADIO_PATH' ) ) { define( 'RADIO_PATH', plugin_dir_path( __FILE__ ) ); } if ( ! defined( 'RADIO_PATH' ) ) { define( 'RADIO_PATH', plugin_dir_path( __FILE__ ) ); }
if ( ! defined( 'RADIO_URL' ) ) { define( 'RADIO_URL', plugin_dir_url( __FILE__ ) ); } if ( ! defined( 'RADIO_URL' ) ) { define( 'RADIO_URL', plugin_dir_url( __FILE__ ) ); }