* Install theme from local JSON file
(
filePath: string,
themeName?: string,
options: EditorInstallOptions = {},
)
| 107 | * Install theme from local JSON file |
| 108 | */ |
| 109 | async installFromFile( |
| 110 | filePath: string, |
| 111 | themeName?: string, |
| 112 | options: EditorInstallOptions = {}, |
| 113 | ): Promise<string> { |
| 114 | console.log(`📁 Loading theme from: ${filePath}`); |
| 115 | |
| 116 | const fs = await import("node:fs/promises"); |
| 117 | const fileContent = await fs.readFile(filePath, "utf-8"); |
| 118 | const themeData = JSON.parse(fileContent); |
| 119 | |
| 120 | const tinteTheme = themeData.rawTheme || themeData; |
| 121 | const name = |
| 122 | themeName || themeData.name || themeData.displayName || "Local Theme"; |
| 123 | const vscodeOverrides = |
| 124 | themeData.vscode_overrides || themeData.overrides?.vscode; |
| 125 | |
| 126 | return this.installTheme(tinteTheme, name, options, vscodeOverrides); |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * Quick install with theme shorthand |