Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { ColorThemeKind, window } from 'vscode'

export function getColorScheme(): string {
const currentThemeKind = window.activeColorTheme.kind
let colorScheme = 'light'
switch (currentThemeKind) {
case ColorThemeKind.Dark:
colorScheme = 'dark'
case ColorThemeKind.Light:
colorScheme = 'light'
case ColorThemeKind.HighContrast:
colorScheme = 'dark'
}

return colorScheme
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export function getAppRootHtml(args: { serverUrl: string }): string {
const { serverUrl } = args
export function getAppRootHtml(args: { serverUrl: string; colorScheme: string }): string {
const { serverUrl, colorScheme } = args

return `<!DOCTYPE html>
<html lang="en" style="height: 100%;">
<html lang="en" class="${colorScheme}" style="height: 100%; color-scheme: ${colorScheme};">
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" href="./dist/ui/index.css">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ExtensionContext, Uri } from 'vscode'
import { getAppRootHtml } from './getStudioPageHtml'
import { getColorScheme } from './getColorScheme'
import { Hono } from 'hono'
import path from 'path'
import { readFile } from 'fs/promises'
Expand Down Expand Up @@ -40,9 +41,12 @@ export async function startStudioServer(args: { dbUrl: string; context: Extensio
return c.json([null, results])
})

// colorScheme
const colorScheme = getColorScheme()

// gives access and renders the main studio page
app.get('/', (c) => {
return c.html(getAppRootHtml({ serverUrl }))
return c.html(getAppRootHtml({ serverUrl, colorScheme }))
})

// gives access to client side rendering resources
Expand Down