774e7f9958
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>
383 lines
10 KiB
CSS
383 lines
10 KiB
CSS
/* Radio — admin styles, WordPress-native */
|
|
|
|
/* ──────────────────────────────────────────────────────────────────
|
|
* Player layout (works inside .postbox .inside on main page,
|
|
* and bare on the dashboard widget where .inside is the parent)
|
|
* ─────────────────────────────────────────────────────────────── */
|
|
|
|
.radio-player {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 14px;
|
|
}
|
|
|
|
/* Now Playing — left-aligned, body text size, no custom typography */
|
|
.radio-player__now {
|
|
display: flex;
|
|
align-items: baseline;
|
|
flex-wrap: wrap;
|
|
gap: 8px;
|
|
padding-bottom: 10px;
|
|
border-bottom: 1px solid #dcdcde;
|
|
}
|
|
|
|
.radio-player__label {
|
|
font-size: 11px;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.06em;
|
|
color: #646970;
|
|
font-weight: 600;
|
|
margin-right: 4px;
|
|
}
|
|
|
|
.radio-player__station-name {
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
color: #1d2327;
|
|
}
|
|
|
|
.radio-player__station-desc {
|
|
font-size: 13px;
|
|
color: #50575e;
|
|
flex: 1 1 100%;
|
|
margin: 0;
|
|
}
|
|
|
|
.radio-player__station-genre {
|
|
font-size: 10px;
|
|
color: #50575e;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.04em;
|
|
font-weight: 600;
|
|
margin-left: 4px;
|
|
padding: 1px 7px;
|
|
background: rgba(0, 0, 0, 0.06);
|
|
border-radius: 10px;
|
|
}
|
|
|
|
/* Current track (poll SomaFM songs endpoint when playing). Hidden when
|
|
we have no track info — the slot still exists in the DOM so JS can
|
|
show/hide without layout shift on first load. */
|
|
.radio-player__track {
|
|
flex: 1 1 100%;
|
|
margin: 4px 0 0;
|
|
font-size: 12px;
|
|
color: #50575e;
|
|
font-style: italic;
|
|
}
|
|
.radio-player__track::before {
|
|
content: '♪ ';
|
|
opacity: 0.6;
|
|
margin-right: 2px;
|
|
}
|
|
|
|
/* Controls — single row, native button + slider */
|
|
.radio-player__controls {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.radio-player__play {
|
|
/* native .button .button-primary styling; just ensure icon aligns */
|
|
display: inline-flex !important;
|
|
align-items: center;
|
|
gap: 6px;
|
|
}
|
|
|
|
.radio-player__play .dashicons {
|
|
font-size: 14px;
|
|
width: 14px;
|
|
height: 14px;
|
|
line-height: 1;
|
|
}
|
|
|
|
.radio-player__volume {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
flex: 0 0 auto;
|
|
width: 220px;
|
|
}
|
|
|
|
.radio-player__volume .dashicons {
|
|
color: #646970;
|
|
font-size: 16px;
|
|
width: 16px;
|
|
height: 16px;
|
|
}
|
|
|
|
/* Mute toggle — the speaker icon is a button. No chrome, just the icon,
|
|
like a YouTube/Spotify mute affordance. Red when muted to make the
|
|
state obvious. */
|
|
.radio-player__mute {
|
|
background: none;
|
|
border: 0;
|
|
padding: 2px;
|
|
margin: 0;
|
|
cursor: pointer;
|
|
color: #646970;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
line-height: 1;
|
|
border-radius: 2px;
|
|
}
|
|
.radio-player__mute:hover { color: #1d2327; }
|
|
.radio-player__mute:focus { outline: 2px solid var(--wp-admin-theme-color, #2271b1); outline-offset: 1px; }
|
|
.radio-player__mute--muted { color: #b32d2e; }
|
|
.radio-player__mute--muted:hover { color: #8a2424; }
|
|
|
|
.radio-player__volume input[type="range"] {
|
|
flex: 1;
|
|
margin: 0;
|
|
/* Use WP's admin theme colour for the slider thumb/track */
|
|
accent-color: var(--wp-admin-theme-color, #2271b1);
|
|
}
|
|
|
|
.radio-player__volume-pct {
|
|
min-width: 36px;
|
|
font-size: 12px;
|
|
color: #646970;
|
|
text-align: right;
|
|
font-variant-numeric: tabular-nums;
|
|
}
|
|
|
|
/* Station selector — label-on-top, full-width select */
|
|
.radio-player__station-select {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 4px;
|
|
}
|
|
|
|
.radio-player__station-select label {
|
|
font-size: 11px;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.06em;
|
|
color: #646970;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.radio-player__station-select select {
|
|
width: 100%;
|
|
max-width: 360px;
|
|
}
|
|
|
|
/* Error notice — uses WP notice styling */
|
|
.radio-player__error {
|
|
color: #b32d2e;
|
|
font-size: 13px;
|
|
padding: 6px 10px;
|
|
background: #fcf0f1;
|
|
border-left: 4px solid #b32d2e;
|
|
border-radius: 0;
|
|
margin: 0;
|
|
}
|
|
|
|
/* Credit footer */
|
|
.radio-player__credit {
|
|
margin: 0;
|
|
color: #646970;
|
|
font-size: 12px;
|
|
}
|
|
|
|
.radio-player__credit--main {
|
|
margin-top: 12px;
|
|
}
|
|
|
|
.radio-player__credit a {
|
|
color: var(--wp-admin-theme-color, #2271b1);
|
|
text-decoration: none;
|
|
}
|
|
|
|
.radio-player__credit a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
|
|
/* ──────────────────────────────────────────────────────────────────
|
|
* 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 {
|
|
margin-top: 4px;
|
|
}
|
|
|
|
.radio-intro {
|
|
margin: 0 0 16px;
|
|
color: #50575e;
|
|
font-size: 13px;
|
|
}
|
|
|
|
/* ──────────────────────────────────────────────────────────────────
|
|
* Dashboard widget — no nested card; bare content inside .inside
|
|
* (WP renders the widget as a postbox already; don't double up)
|
|
* ─────────────────────────────────────────────────────────────── */
|
|
|
|
#radio_dashboard_widget .radio-player {
|
|
gap: 10px;
|
|
}
|
|
|
|
#radio_dashboard_widget .radio-player__now {
|
|
padding-bottom: 8px;
|
|
}
|
|
|
|
#radio_dashboard_widget .radio-player__station-name {
|
|
font-size: 14px;
|
|
}
|
|
|
|
#radio_dashboard_widget .radio-player__credit {
|
|
border-top: 1px solid #dcdcde;
|
|
padding-top: 8px;
|
|
margin-top: 4px;
|
|
text-align: center;
|
|
}
|
|
|
|
/* ──────────────────────────────────────────────────────────────────
|
|
* About page — postbox-style cards in a metabox column layout
|
|
* ─────────────────────────────────────────────────────────────── */
|
|
|
|
.radio-about-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
|
|
gap: 16px;
|
|
max-width: 1100px;
|
|
margin-top: 16px;
|
|
}
|
|
|
|
.radio-about-card {
|
|
background: #fff;
|
|
border: 1px solid #c3c4c7;
|
|
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
|
|
}
|
|
|
|
.radio-about-card h2 {
|
|
margin: 0;
|
|
padding: 8px 12px;
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
background: #f6f7f7;
|
|
border-bottom: 1px solid #c3c4c7;
|
|
}
|
|
|
|
.radio-about-card > p,
|
|
.radio-about-card > ul,
|
|
.radio-about-card > a {
|
|
padding: 12px;
|
|
margin: 0;
|
|
}
|
|
|
|
.radio-about-card > p + p {
|
|
padding-top: 0;
|
|
}
|
|
|
|
.radio-about-card--versions ul {
|
|
list-style: none;
|
|
padding: 12px;
|
|
margin: 0;
|
|
}
|
|
|
|
.radio-about-card--versions li {
|
|
margin-bottom: 10px;
|
|
font-size: 13px;
|
|
}
|
|
|
|
.radio-about-card--versions li:last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.radio-about-card--versions .ver {
|
|
font-weight: 600;
|
|
color: var(--wp-admin-theme-color, #2271b1);
|
|
}
|
|
|
|
.radio-about-card--versions .latest {
|
|
display: inline-block;
|
|
margin-left: 6px;
|
|
padding: 1px 7px;
|
|
background: #00a32a;
|
|
color: #fff;
|
|
border-radius: 9px;
|
|
font-size: 11px;
|
|
font-weight: 600;
|
|
vertical-align: middle;
|
|
}
|
|
|
|
.radio-about-changelog-link {
|
|
display: inline-block;
|
|
margin: 0 12px 12px;
|
|
font-size: 13px;
|
|
color: var(--wp-admin-theme-color, #2271b1);
|
|
text-decoration: none;
|
|
}
|
|
|
|
.radio-about-changelog-link:hover {
|
|
text-decoration: underline;
|
|
}
|
|
|
|
/* ──────────────────────────────────────────────────────────────────
|
|
* Dark theme — body.radio-theme-dark forces dark; body.radio-theme-auto
|
|
* follows the OS via `prefers-color-scheme`. body.radio-theme-light is a
|
|
* no-op (the existing rules above are light).
|
|
*
|
|
* Scope is the player + the about-cards. The WP postbox chrome stays
|
|
* under WordPress's own admin colour scheme — we only retint surfaces
|
|
* we own.
|
|
* ─────────────────────────────────────────────────────────────── */
|
|
|
|
.radio-theme-dark .radio-player__now {
|
|
border-bottom-color: #3c434a;
|
|
}
|
|
.radio-theme-dark .radio-player__station-name { color: #f0f0f1; }
|
|
.radio-theme-dark .radio-player__label,
|
|
.radio-theme-dark .radio-player__station-genre,
|
|
.radio-theme-dark .radio-player__volume-pct,
|
|
.radio-theme-dark .radio-player__credit,
|
|
.radio-theme-dark .radio-player__mute,
|
|
.radio-theme-dark .radio-player__station-select label,
|
|
.radio-theme-dark .radio-player__volume .dashicons {
|
|
color: #a7aaad;
|
|
}
|
|
.radio-theme-dark .radio-player__mute:hover { color: #f0f0f1; }
|
|
.radio-theme-dark .radio-player__mute--muted { color: #ff8b8b; }
|
|
.radio-theme-dark .radio-player__station-desc,
|
|
.radio-theme-dark .radio-player__track,
|
|
.radio-theme-dark .radio-intro {
|
|
color: #c3c4c7;
|
|
}
|
|
.radio-theme-dark .radio-player__station-genre {
|
|
background: rgba(255, 255, 255, 0.08);
|
|
}
|
|
.radio-theme-dark .radio-player__error {
|
|
background: rgba(179, 45, 46, 0.18);
|
|
color: #ff9b9b;
|
|
}
|
|
.radio-theme-dark .radio-about-card {
|
|
background: #1d2327;
|
|
border-color: #3c434a;
|
|
color: #c3c4c7;
|
|
}
|
|
.radio-theme-dark .radio-about-card h2 {
|
|
background: #2c3338;
|
|
color: #f0f0f1;
|
|
border-bottom-color: #3c434a;
|
|
}
|
|
.radio-theme-dark #radio_dashboard_widget .radio-player__credit {
|
|
border-top-color: #3c434a;
|
|
}
|
|
|
|
/* Give the player its own dark surface when theme=dark so the dark text
|
|
has something to read against — WP postboxes don't follow our dark
|
|
choice, so without this the light text would sit on white. */
|
|
.radio-theme-dark .radio-player {
|
|
background: #1d2327;
|
|
padding: 14px 16px;
|
|
border-radius: 3px;
|
|
border: 1px solid #3c434a;
|
|
}
|