feat: dark mode (light/dark/system) with persisted preference#414
Open
shaunpatterson wants to merge 3 commits into
Open
feat: dark mode (light/dark/system) with persisted preference#414shaunpatterson wants to merge 3 commits into
shaunpatterson wants to merge 3 commits into
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Editor.scss paints .cm-invalidchar black on purpose: the graphql-ish editor mode flags valid DQL (dotted predicates like dgraph.type, numeric arguments) as invalid, and black-on-white makes those tokens read as normal text. On the dark background they were invisible. Mirror the intent under [data-theme='dark']: normal text color. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The EditorTabs strip used hardcoded light colors, leaving a bright bar above the editor in dark mode. Add [data-theme=dark] overrides so the strip, inactive tabs, hover and rename input use the dark palette, and the active tab blends into the editor header (--bg-raised) below it. (EditorTabs ships on the multi-tab branch; these rules are dormant until both features are present, e.g. on sp/all-features.) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds dark mode with three settings — light / dark / system — cycled by a sun/moon toggle pinned to the bottom of the sidebar. The preference lives in the (already persisted)
uistore;systemfollowsprefers-color-schemelive via amatchMedialistener.How
App.jsappliesdata-themeto<html>from the resolved setting.assets/css/theme-dark.scss— all overrides scoped under[data-theme='dark'], built on a small set of CSS custom properties (--bg,--bg-raised,--text,--border, …). Bootstrap is deliberately not fully rethemed; only the surfaces Ratel uses are (panels, frames, modals, dropdowns, tables, forms, nav-tabs, alerts, the graph canvas background, entity selector, history strip).material-darkertheme when dark.lib/theme.js(resolveTheme,nextTheme) + reducer actionsetTheme.Two real bugs found and fixed during verification:
Editor.scssgutter/cursor rules outranked the CM theme by source order — re-asserted under the dark scope..cm-invalidcharis painted black byEditor.scss(a deliberate hack: the graphql-ish editor mode flags valid DQL like dotted predicates as invalid, and black-on-white reads as normal text). On dark these tokens were invisible — the dark scope now mirrors the intent with the normal dark text color. Verified per-token via computed styles in headless Chrome.Testing
data-theme, body background luminance < 80, persisted setting, and that the theme survives a full page reload. Light mode screenshot-verified unchanged.npm run buildpasses.Known limits: less-traveled pages (ACL/Backups/Cluster) inherit the generic overrides but weren't individually audited; the JSON tab gets a partial dark hljs override; graph node colors are JS-generated and unchanged.
🤖 Generated with Claude Code