2024-07-31 04:52:50 +02:00
|
|
|
// Copyright 2024, Command Line Inc.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2024-11-21 19:44:16 +01:00
|
|
|
export const DefaultTermTheme = "default-dark";
|
2024-07-31 04:52:50 +02:00
|
|
|
|
2024-11-21 19:44:16 +01:00
|
|
|
// returns (theme, bgcolor)
|
|
|
|
function computeTheme(fullConfig: FullConfigType, themeName: string): [TermThemeType, string] {
|
|
|
|
let theme: TermThemeType = fullConfig?.termthemes?.[themeName];
|
|
|
|
if (theme == null) {
|
|
|
|
theme = fullConfig?.termthemes?.[DefaultTermTheme] || ({} as any);
|
2024-07-31 04:52:50 +02:00
|
|
|
}
|
2024-11-21 19:44:16 +01:00
|
|
|
const themeCopy = { ...theme };
|
|
|
|
let bgcolor = themeCopy.background;
|
|
|
|
themeCopy.background = "#00000000";
|
|
|
|
return [themeCopy, bgcolor];
|
2024-07-31 04:52:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export { computeTheme };
|