The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat: system default theme for studio
Harsh Karande46944ea8bc2a
diff --git a/studio/pages/account/me.tsx b/studio/pages/account/me.tsxindex 02b537af4b7..70b34764b2f 100644--- a/studio/pages/account/me.tsx+++ b/studio/pages/account/me.tsx@@ -101,13 +101,13 @@ function ThemeSettings() {descriptionText="Choose a theme preference"layout="horizontal"style={{ width: '50%' }}- icon={theme === 'light' ? <IconSun /> : <IconMoon />}+ icon={theme === 'light' ? <IconSun /> : theme === 'dark' ? <IconMoon /> : undefined}onChange={(e: any) => {setTheme(e.target.value)ui.setTheme(e.target.value)}}>- {/* <Select.Option value="system">System default</Select.Option> */}+ <Select.Option value="system">System default</Select.Option><Select.Option value="dark">Dark</Select.Option><Select.Option value="light">Light</Select.Option></Select>diff --git a/studio/stores/UiStore.ts b/studio/stores/UiStore.tsindex e2f46376a38..ee06658aa06 100644--- a/studio/stores/UiStore.ts+++ b/studio/stores/UiStore.ts@@ -6,7 +6,7 @@ import Telemetry from 'lib/telemetry'export interface IUiStore {language: 'en_US'- theme: 'dark' | 'light'+ theme: 'dark' | 'light' | 'system'isDarkTheme: booleanselectedProject?: Project@@ -25,7 +25,7 @@ export interface IUiStore {export default class UiStore implements IUiStore {rootStore: IRootStorelanguage: 'en_US' = 'en_US'- theme: 'dark' | 'light' = 'dark'+ theme: 'dark' | 'light' | 'system' = 'dark'selectedProjectRef?: stringselectedOrganizationSlug?: string@@ -68,27 +68,33 @@ export default class UiStore implements IUiStore {}get isDarkTheme() {- return this.theme === 'dark'+ return (+ this.theme === 'dark' ||+ (this.theme === 'system' && window.matchMedia('(prefers-color-scheme: dark)').matches)+ )}load() {if (typeof window === 'undefined') return- const savedTheme = (window.localStorage.getItem('theme') ?? 'dark') as 'dark' | 'light'- this.setTheme(savedTheme)+ let savedTheme = (window.localStorage.getItem('theme') ?? 'dark') as 'dark' | 'light' | 'system'+ if (['dark', 'light', 'system'].includes(savedTheme)) return this.setTheme(savedTheme)+ this.setTheme('dark')}toggleTheme() {- if (this.theme === 'dark') {- this.setTheme('light')- } else {- this.setTheme('dark')- }+ if (this.theme === 'system' && window.matchMedia('(prefers-color-scheme: dark)').matches)+ return this.setTheme('light')+ if (this.theme === 'dark') return this.setTheme('light')+ this.setTheme('dark')}- setTheme(theme: 'dark' | 'light') {+ setTheme(theme: 'dark' | 'light' | 'system') {this.theme = themewindow.localStorage.setItem('theme', theme)- document.body.className = theme+ if (theme !== 'system') return (document.body.className = theme)+ if (window.matchMedia('(prefers-color-scheme: dark)').matches)+ return (document.body.className = 'dark')+ document.body.className = 'light'}setProjectRef(ref?: string) {