-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
tokens.ts
113 lines (95 loc) · 2.45 KB
/
tokens.ts
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
import { IChangedArgs } from '@jupyterlab/coreutils';
import { Token } from '@phosphor/coreutils';
import { IDisposable } from '@phosphor/disposable';
import { ISignal } from '@phosphor/signaling';
/* tslint:disable */
/**
* The theme manager token.
*/
export const IThemeManager = new Token<IThemeManager>(
'@jupyterlab/apputils:IThemeManager'
);
/* tslint:enable */
/**
* An interface for a theme manager.
*/
export interface IThemeManager {
/**
* Get the name of the current theme.
*/
readonly theme: string | null;
/**
* The names of the registered themes.
*/
readonly themes: ReadonlyArray<string>;
/**
* A signal fired when the application theme changes.
*/
readonly themeChanged: ISignal<this, IChangedArgs<string>>;
/**
* Load a theme CSS file by path.
*
* @param path - The path of the file to load.
*/
loadCSS(path: string): Promise<void>;
/**
* Register a theme with the theme manager.
*
* @param theme - The theme to register.
*
* @returns A disposable that can be used to unregister the theme.
*/
register(theme: IThemeManager.ITheme): IDisposable;
/**
* Set the current theme.
*/
setTheme(name: string): Promise<void>;
/**
* Test whether a given theme is light.
*/
isLight(name: string): boolean;
/**
* Test whether a given theme styles scrollbars,
* and if the user has scrollbar styling enabled.
*/
themeScrollbars(name: string): boolean;
}
/**
* A namespace for the `IThemeManager` sub-types.
*/
export namespace IThemeManager {
/**
* An interface for a theme.
*/
export interface ITheme {
/**
* The display name of the theme.
*/
name: string;
/**
* Whether the theme is light or dark. Downstream authors
* of extensions can use this information to customize their
* UI depending upon the current theme.
*/
isLight: boolean;
/**
* Whether the theme includes styling for the scrollbar.
* If set to false, this theme will leave the native scrollbar untouched.
*/
themeScrollbars?: boolean;
/**
* Load the theme.
*
* @returns A promise that resolves when the theme has loaded.
*/
load(): Promise<void>;
/**
* Unload the theme.
*
* @returns A promise that resolves when the theme has unloaded.
*/
unload(): Promise<void>;
}
}