-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.tera
76 lines (65 loc) · 2.02 KB
/
index.tera
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
whiskers:
version: 2.5.1
filename: "src/index.ts"
---
import {
JupyterFrontEnd,
JupyterFrontEndPlugin
} from '@jupyterlab/application';
import { IThemeManager } from '@jupyterlab/apputils';
import { ISettingRegistry } from '@jupyterlab/settingregistry';
import { CatppuccinPalettes } from './palettes';
/**
* Initialization data for the catppuccin_jupyterlab extension.
*/
const plugin: JupyterFrontEndPlugin<void> = {
id: 'catppuccin_jupyterlab:plugin',
description: '📊 Soothing pastel theme for JupyterLab.',
autoStart: true,
requires: [IThemeManager],
optional: [ISettingRegistry],
activate: (
app: JupyterFrontEnd,
manager: IThemeManager,
settingRegistry: ISettingRegistry | null
) => {
const style = 'catppuccin_jupyterlab/index.css';
const palettes = new CatppuccinPalettes();
let brandColor = 'mauve';
let accentColor = 'green';
function loadSettings(settingRegistry: ISettingRegistry | null) {
if (settingRegistry) {
settingRegistry
.load(plugin.id)
.then(settings => {
brandColor = settings.get('brandColor').composite as string;
accentColor = settings.get('accentColor').composite as string;
console.debug(
`catppuccin_jupyterlab settings loaded. Brand color is '${brandColor}', Accent color is '${accentColor}'`
);
})
.catch(reason => {
console.error(
'Failed to load settings for catppuccin_jupyterlab.',
reason
);
});
}
}
loadSettings(settingRegistry);
{%- for id, flavor in flavors %}
manager.register({
name: 'Catppuccin {{flavor.name}}',
isLight: {{not flavor.dark}},
load: () => {
palettes.setColors{{flavor.name | slugify | capitalize}}();
palettes.setConfigColors(brandColor, accentColor);
return manager.loadCSS(style);
},
unload: () => Promise.resolve(undefined)
});
{%- endfor %}
}
};
export default plugin;