Skip to content

Libraries: add a dark theme with a toggle - #380

Open
j-w9 wants to merge 2 commits into
ArduPilot:mainfrom
j-w9:dark-mode
Open

j-w9 wants to merge 2 commits into
ArduPilot:mainfrom
j-w9:dark-mode

Conversation

@j-w9

@j-w9 j-w9 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Follow up to #361. Adds Libraries/theme.js and dark styles in common.css.

  • The theme follows the system setting until the toggle in the page header is used, then the choice is saved in local storage and used on every tool. Nothing else is stored.
  • The toggle is in each page's header beside the GitHub link, drawn the same way.
  • theme.js runs in the head so the page is drawn in the right theme from the start, with no flash of the light page.
  • Plotly plots get a dark template from theme.js, so only Plotly's defaults change and colours set by the tools are kept. This covers 2D and 3D axes, the mode bar, legends and shapes. Traces drawn in black and light grey shaded shapes (Filter Review notch ranges) are swapped for light and dark grey, and back when the theme is changed with plots already drawn.
  • Title tooltips are drawn by the page in the dark theme, as the browser draws them in the system colours.
  • Tabulator tables (Log Finder) have dark styles, and table borders set in code are drawn in the text colour.
  • Landing page screenshots of plots are shown inverted in the dark theme, maps and icons are left as they are.

Light mode is unchanged: every tool below the header is pixel identical to master with a log loaded.

Left out: DFULoader and SysID; VideoOverlay, as its own styles force a light panel; and AILogAnalyzer, GeofenceGenerator, SimpleGCS, TelemetryDashboard and ThrustExpo, which don't use common.css.

theme.js applies the theme before the page is drawn: it follows the
system setting until the toggle in the page header is used, then the
choice is saved and used on every tool.

The dark styles are in common.css. Plotly plots are themed by replacing
only Plotly's default colours, so colours set by the tools are kept and
no plotting code changes.

VideoOverlay is left out for now as its own styles force a light panel.
Comment thread Libraries/theme.js Resolved
@IamPete1

Copy link
Copy Markdown
Member

The plotly toolbar looks bad.

image

@IamPete1

Copy link
Copy Markdown
Member

Also I think its worth doing a better job than a standard button shoved up in the corner. This might mean you have to add the element from the individual HTML rather than injecting it from the script.

@IamPete1

Copy link
Copy Markdown
Member

LogFinder table looks bad in dark mode too.

MAGFit has hard coded black lines which disappear.

image

Comment thread DFULoader/index.html Resolved
@IamPete1

Copy link
Copy Markdown
Member

The landing pages look quite bad because all the screen shots have white backgrounds. Also the dev tools icon on the main page disapears.

@IamPete1

Copy link
Copy Markdown
Member

The standard html popups look bad.

image

@IamPete1

Copy link
Copy Markdown
Member

PID review param table disappears.

image

@IamPete1

Copy link
Copy Markdown
Member

Filter reivew notch lines are black and disapear.

image

Comment thread SysID/index.html Resolved
@IamPete1

Copy link
Copy Markdown
Member

SCurve tool has another hard coded black line that disapears.

@IamPete1

IamPete1 commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Mostly looks good, but if were going to do it then we have to make sure that everything works. I have not had a in-dept look but I have found lots of little issues.

Please actually check each tool carefully, don't just fire off AI on my comments.

…ach page header

Replace the CSS overrides of Plotly's colours with a dark template that
theme.js applies to every plot, so 3D axes, the mode bar and shape lines
are themed too. Black traces and light grey shaded shapes are swapped
for their dark theme equivalents and back when the theme changes.

The toggle is now part of each page header, beside the GitHub link.
Title tooltips are drawn by the page in the dark theme, as the browser
draws them in the system colours. Add dark styles for Tabulator tables,
draw table borders in the text colour, and show the landing page plot
screenshots inverted in the dark theme.

DFULoader and SysID are left out.
@j-w9

j-w9 commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

Fair point, I went through every tool again in both themes with logs loaded and changed the approach. Plots now get a dark Plotly template from theme.js rather than CSS overrides of Plotly's colours, which also covers the mode bar, 3D axes (Rotation Check, SCurve and Hardware Report were barely readable) and shape lines. Black traces and the light grey notch ranges are swapped for light and dark grey, and swapped back if the theme is changed with plots drawn. The toggle is now in each page's header next to the GitHub link. Title tooltips are drawn by the page in dark mode, Log Finder's table has dark styles, table borders follow the text colour (PID Review), and the landing page screenshots are inverted with their hues kept. Light mode is pixel identical to master below the header on every tool with a log loaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants