How to use the @theia/core/lib/browser/theming.ThemeService.get function in @theia/core

To help you get started, we’ve selected a few @theia/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eclipse-theia / theia / packages / monaco / src / browser / monaco-theming-service.ts View on Github external
protected static updateBodyUiTheme(): void {
        this.toUpdateUiTheme.dispose();
        const type = ThemeService.get().getCurrentTheme().type;
        const uiTheme: monaco.editor.BuiltinTheme = type === 'hc' ? 'hc-black' : type === 'light' ? 'vs' : 'vs-dark';
        document.body.classList.add(uiTheme);
        this.toUpdateUiTheme.push(Disposable.create(() => document.body.classList.remove(uiTheme)));
    }
github eclipsesource / graphical-lsp / client / chillisp-client-extension / src / browser / theme-manager.ts View on Github external
initialize() {
        const themeService = ThemeService.get()
        this.switchTheme(undefined, themeService.getCurrentTheme())
        this.disposable = themeService.onThemeChange(event => this.switchTheme(event.oldTheme, event.newTheme))
    }
github eclipse-theia / theia / packages / task / src / browser / quick-open-task.ts View on Github external
protected updateTheme(): void {
        const theme = ThemeService.get().getCurrentTheme().id;
        if (theme === 'dark') {
            this.class = 'quick-open-task-configure-dark';
        } else if (theme === 'light') {
            this.class = 'quick-open-task-configure-bright';
        }
    }
}
github eclipse-theia / theia / packages / debug / src / browser / debug-frontend-application-contribution.ts View on Github external
const darkCss = require('../../src/browser/style/debug-dark.useable.css');
const lightCss = require('../../src/browser/style/debug-bright.useable.css');

function updateTheme(): void {
    const themeType = ThemeService.get().getCurrentTheme().type;
    if (themeType === 'dark' || themeType === 'hc') {
        lightCss.unuse();
        darkCss.use();
    } else if (themeType === 'light') {
        darkCss.unuse();
        lightCss.use();
    }
}
updateTheme();
ThemeService.get().onThemeChange(() => updateTheme());

@injectable()
export class DebugFrontendApplicationContribution extends AbstractViewContribution implements TabBarToolbarContribution, ColorContribution {

    @inject(DebugService)
    protected readonly debug: DebugService;

    @inject(DebugSessionManager)
    protected readonly manager: DebugSessionManager;

    @inject(DebugConfigurationManager)
    protected readonly configurations: DebugConfigurationManager;

    @inject(BreakpointManager)
    protected readonly breakpointManager: BreakpointManager;
github eclipsesource / coffee-editor / web / coffee-workflow-analyzer-editors / src / browser / frontend-extension.ts View on Github external
export default new ContainerModule(bind => {
    ThemeService.get().setCurrentTheme(LIGHT_THEME_ID);

    bind(WorkflowClientContribution).toSelf().inSingletonScope();
    bind(LanguageClientContribution).toDynamicValue(ctx => ctx.container.get(WorkflowClientContribution));
});
github eclipse-theia / theia / packages / monaco / src / browser / monaco-theming-service.ts View on Github external
protected static doRegister(state: MonacoThemingService.MonacoThemeState): Disposable {
        const { id, label, description, uiTheme, data } = state;
        const type = uiTheme === 'vs' ? 'light' : uiTheme === 'vs-dark' ? 'dark' : 'hc';
        const builtInTheme = uiTheme === 'vs' ? BuiltinThemeProvider.lightCss : BuiltinThemeProvider.darkCss;
        const toDispose = new DisposableCollection(ThemeService.get().register({
            type,
            id,
            label,
            description: description,
            editorTheme: data.name!,
            activate(): void {
                builtInTheme.use();
            },
            deactivate(): void {
                builtInTheme.unuse();
            }
        }));
        this.storeTheme(state, toDispose);
        return toDispose;
    }
github eclipse-theia / theia / packages / plugin-ext / src / main / browser / webview / webview-theme-data-provider.ts View on Github external
protected getActiveTheme(): WebviewThemeType {
        const theme = ThemeService.get().getCurrentTheme();
        switch (theme.type) {
            case 'light': return 'vscode-light';
            case 'dark': return 'vscode-dark';
            default: return 'vscode-high-contrast';
        }
    }
github eclipsesource / graphical-lsp / client / examples / browser-app / src-gen / frontend / index.js View on Github external
function start() {
    const themeService = ThemeService.get()
    themeService.loadUserTheme();

    const application = container.get(FrontendApplication);
    application.start();
}
github eclipsesource / graphical-lsp / client / packages / workflow-glsp-extension / src / browser / diagram / thememanager.ts View on Github external
initialize() {
        const themeService = ThemeService.get()
        this.switchTheme(undefined, themeService.getCurrentTheme())
        this.disposable = themeService.onThemeChange(event => this.switchTheme(event.oldTheme, event.newTheme))
    }
github eclipse-theia / theia / packages / monaco / src / browser / monaco-editor-provider.ts View on Github external
import { MonacoEditorModel } from './monaco-editor-model';
import { MonacoEditorService } from './monaco-editor-service';
import { MonacoQuickOpenService } from './monaco-quick-open-service';
import { MonacoTextModelService } from './monaco-text-model-service';
import { MonacoWorkspace } from './monaco-workspace';
import { ThemeService } from '@theia/core/lib/browser/theming';

import IEditorOverrideServices = monaco.editor.IEditorOverrideServices;

function changeTheme(editorTheme: string | undefined) {
    const monacoTheme = editorTheme || 'vs-dark';
    monaco.editor.setTheme(monacoTheme);
    document.body.classList.add(monacoTheme);
}
changeTheme(ThemeService.get().getCurrentTheme().editorTheme);
ThemeService.get().onThemeChange(event => changeTheme(event.newTheme.editorTheme));

@injectable()
export class MonacoEditorProvider {

    constructor(
        @inject(MonacoEditorService) protected readonly editorService: MonacoEditorService,
        @inject(MonacoTextModelService) protected readonly textModelService: MonacoTextModelService,
        @inject(MonacoContextMenuService) protected readonly contextMenuService: MonacoContextMenuService,
        @inject(MonacoToProtocolConverter) protected readonly m2p: MonacoToProtocolConverter,
        @inject(ProtocolToMonacoConverter) protected readonly p2m: ProtocolToMonacoConverter,
        @inject(MonacoWorkspace) protected readonly workspace: MonacoWorkspace,
        @inject(MonacoCommandServiceFactory) protected readonly commandServiceFactory: MonacoCommandServiceFactory,
        @inject(EditorPreferences) protected readonly editorPreferences: EditorPreferences,
        @inject(MonacoQuickOpenService) protected readonly quickOpenService: MonacoQuickOpenService
    ) { }