This commit is contained in:
Red Adaya 2024-04-04 11:04:34 +08:00
parent 97595a7718
commit 8afa62fff2
2 changed files with 0 additions and 20 deletions

View File

@ -258,25 +258,6 @@ class Model {
});
}
updateTermTheme(element: HTMLElement, themeFileName: string, reset: boolean) {
const url = new URL(this.getBaseHostPort() + `/config/terminal-themes/${themeFileName}.json`);
return fetch(url, { method: "get", body: null, headers: this.getFetchHeaders() })
.then((resp) => resp.json())
.then((themeVars: TermThemeType) => {
Object.keys(themeVars).forEach((key) => {
if (reset) {
this.resetStyleVar(element, `--term-${key}`);
} else {
this.resetStyleVar(element, `--term-${key}`);
this.setStyleVar(element, `--term-${key}`, themeVars[key]);
}
});
})
.catch((error) => {
console.error(`error applying theme: ${themeFileName}`, error);
});
}
getTermThemeJson(themeFileName: string) {
const url = new URL(this.getBaseHostPort() + `/config/terminal-themes/${themeFileName}.json`);
return fetch(url, { method: "get", body: null, headers: this.getFetchHeaders() })

View File

@ -53,7 +53,6 @@ type TermWrapOpts = {
function getThemeFromCSSVars(themeSrcEl: HTMLElement): ITheme {
const theme: ITheme = {};
console.log("themeSrcEl", themeSrcEl);
const tse = themeSrcEl ?? document.documentElement;
let rootStyle = getComputedStyle(tse);
theme.foreground = rootStyle.getPropertyValue("--term-foreground");