Skip to content

Commit ffd6a31

Browse files
andrew-centmlAndrew Tham
andauthored
support dark mode (#95)
Co-authored-by: Andrew Tham <[email protected]>
1 parent 09deb1d commit ffd6a31

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

deepview-explore/react-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"react-dom": "^18.2.0"
1818
},
1919
"devDependencies": {
20-
"@centml/deepview-ui": "^0.1.5",
20+
"@centml/deepview-ui": "^0.1.7",
2121
"@centml/ui": "^1.8.9",
2222
"@testing-library/react": "^14.2.2",
2323
"@types/node": "^20.12.2",

deepview-explore/react-ui/src/layout/Layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const Layout = ({ children }: PropsWithChildren) => {
66
return (
77
<div className="flex h-screen flex-col">
88
<Header />
9-
<div className="flex grow flex-col bg-gray-100 px-4">
9+
<div className="flex grow flex-col bg-gray-100 px-4 dark:bg-neutral-900">
1010
<TabGroup
1111
items={[
1212
{

deepview-explore/src/skyline_session.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,12 +401,13 @@ export class SkylineSession {
401401
const scriptUri = this.webviewPanel.webview.asWebviewUri(scriptPathOnDisk);
402402
const stylePathOnDisk = vscode.Uri.file(path.join(buildPath, 'build', mainStyle));
403403
const styleUri = this.webviewPanel.webview.asWebviewUri(stylePathOnDisk);
404+
const themeClass = vscode.window.activeColorTheme.kind === vscode.ColorThemeKind.Dark ? 'dark' : 'light';
404405

405406
// Use a nonce to whitelist which scripts can be run
406407
const nonce = crypto.randomBytes(16).toString('base64');
407408

408409
return `<!DOCTYPE html>
409-
<html lang="en">
410+
<html lang="en" class="${themeClass}">
410411
<head>
411412
<meta charset="utf-8">
412413
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">

0 commit comments

Comments
 (0)