Remove system theme, keep light/dark/neon only

This commit is contained in:
Avi 2026-08-24 14:23:15 -05:00
commit a01f258d4b
7 changed files with 8 additions and 14 deletions

View file

@ -1,4 +1,4 @@
export type Theme = 'light' | 'dark' | 'system' | 'neon'; export type Theme = 'light' | 'dark' | 'neon';
/** Lifecycle of the NIP-46 remote signer. */ /** Lifecycle of the NIP-46 remote signer. */
export type SignerPhase = 'stopped' | 'connecting' | 'connected'; export type SignerPhase = 'stopped' | 'connecting' | 'connected';

View file

@ -104,12 +104,11 @@ export function SettingsScreen() {
> >
<option value="light">Light</option> <option value="light">Light</option>
<option value="dark">Dark</option> <option value="dark">Dark</option>
<option value="system">System</option>
<option value="neon">Neon</option> <option value="neon">Neon</option>
</select> </select>
<p className="hint"> <p className="hint">
“System” follows your desktop's light or dark preference. “Neon” is a pure-black “Light” and “Dark” follow your manual selection. “Neon” is a pure-black theme with
theme with pink and purple accents. pink and purple accents.
</p> </p>
</div> </div>
</div> </div>

View file

@ -335,16 +335,13 @@ export function useApp(): AppContextValue {
return context; return context;
} }
/** Apply the requested theme (respecting system preference for `system`). */ /** Apply the requested theme. */
export function applyTheme(theme: Theme): void { export function applyTheme(theme: Theme): void {
if (theme === 'neon') { if (theme === 'neon') {
document.documentElement.dataset.theme = 'neon'; document.documentElement.dataset.theme = 'neon';
return; return;
} }
const prefersDark = document.documentElement.dataset.theme = theme;
theme === 'dark' ||
(theme === 'system' && window.matchMedia('(prefers-color-scheme: dark)').matches);
document.documentElement.dataset.theme = prefersDark ? 'dark' : 'light';
} }
/** Keep the document theme in sync with settings, watching system changes. */ /** Keep the document theme in sync with settings, watching system changes. */

View file

@ -24,7 +24,7 @@ describe('FeedScreen', () => {
it('disable relays shows an empty state that can navigate to relays', async () => { it('disable relays shows an empty state that can navigate to relays', async () => {
const settings = { const settings = {
theme: 'system' as const, theme: 'light' as const,
confirm_before_publish: true, confirm_before_publish: true,
shorten_npub: true, shorten_npub: true,
relays: [ relays: [

View file

@ -25,7 +25,7 @@ export function makeState(overrides?: Partial<AppState>): AppState {
is_active: false, is_active: false,
}; };
const settings: Settings = { const settings: Settings = {
theme: 'system', theme: 'light',
confirm_before_publish: true, confirm_before_publish: true,
shorten_npub: true, shorten_npub: true,
relays: [ relays: [

View file

@ -35,7 +35,7 @@ Commands:
relays disable <url> Disable a relay relays disable <url> Disable a relay
relays test <url> Test a relay connection relays test <url> Test a relay connection
settings get Show application settings settings get Show application settings
settings set theme <light|dark|system|neon> settings set theme <light|dark|neon>
settings set confirm <true|false> settings set confirm <true|false>
settings set shorten <true|false> settings set shorten <true|false>
delete-profile <npub> Delete a profile (moves it to undo stack) delete-profile <npub> Delete a profile (moves it to undo stack)

View file

@ -22,7 +22,6 @@ impl RelayConfig {
pub enum Theme { pub enum Theme {
Light, Light,
Dark, Dark,
System,
Neon, Neon,
} }
@ -32,7 +31,6 @@ impl Theme {
match s { match s {
"light" => Some(Self::Light), "light" => Some(Self::Light),
"dark" => Some(Self::Dark), "dark" => Some(Self::Dark),
"system" => Some(Self::System),
"neon" => Some(Self::Neon), "neon" => Some(Self::Neon),
_ => None, _ => None,
} }