2024-07-31 04:52:50 +02:00
|
|
|
// Copyright 2024, Command Line Inc.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
import * as util from "@/util/util";
|
|
|
|
|
2024-08-28 03:49:49 +02:00
|
|
|
function computeTheme(fullConfig: FullConfigType, themeName: string): TermThemeType {
|
2024-07-31 04:52:50 +02:00
|
|
|
let defaultThemeName = "default-dark";
|
|
|
|
themeName = themeName ?? "default-dark";
|
2024-08-28 03:49:49 +02:00
|
|
|
const defaultTheme: TermThemeType = fullConfig?.termthemes?.[defaultThemeName] || ({} as any);
|
|
|
|
const theme: TermThemeType = fullConfig?.termthemes?.[themeName] || ({} as any);
|
2024-07-31 04:52:50 +02:00
|
|
|
const combinedTheme = { ...defaultTheme };
|
|
|
|
for (const key in theme) {
|
|
|
|
if (!util.isBlank(theme[key])) {
|
|
|
|
combinedTheme[key] = theme[key];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return combinedTheme;
|
|
|
|
}
|
|
|
|
|
|
|
|
export { computeTheme };
|