UNPKG

2.26 kBJavaScriptView Raw
1"use strict";
2// *****************************************************************************
3// Copyright (C) 2019 TypeFox and others.
4//
5// This program and the accompanying materials are made available under the
6// terms of the Eclipse Public License v. 2.0 which is available at
7// http://www.eclipse.org/legal/epl-2.0.
8//
9// This Source Code may also be made available under the following Secondary
10// Licenses when the conditions for such availability set forth in the Eclipse
11// Public License v. 2.0 are satisfied: GNU General Public License, version 2
12// with the GNU Classpath Exception which is available at
13// https://www.gnu.org/software/classpath/license.html.
14//
15// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16// *****************************************************************************
17Object.defineProperty(exports, "__esModule", { value: true });
18exports.ColorRegistry = void 0;
19const tslib_1 = require("tslib");
20const inversify_1 = require("inversify");
21const disposable_1 = require("../common/disposable");
22const event_1 = require("../common/event");
23let ColorRegistry = class ColorRegistry {
24 constructor() {
25 this.onDidChangeEmitter = new event_1.Emitter();
26 this.onDidChange = this.onDidChangeEmitter.event;
27 }
28 fireDidChange() {
29 this.onDidChangeEmitter.fire(undefined);
30 }
31 *getColors() { }
32 getCurrentCssVariable(id) {
33 const value = this.getCurrentColor(id);
34 if (!value) {
35 return undefined;
36 }
37 const name = this.toCssVariableName(id);
38 return { name, value };
39 }
40 toCssVariableName(id, prefix = 'theia') {
41 return `--${prefix}-${id.replace(/\./g, '-')}`;
42 }
43 getCurrentColor(id) {
44 return undefined;
45 }
46 register(...definitions) {
47 const result = new disposable_1.DisposableCollection(...definitions.map(definition => this.doRegister(definition)));
48 this.fireDidChange();
49 return result;
50 }
51 doRegister(definition) {
52 return disposable_1.Disposable.NULL;
53 }
54};
55ColorRegistry = (0, tslib_1.__decorate)([
56 (0, inversify_1.injectable)()
57], ColorRegistry);
58exports.ColorRegistry = ColorRegistry;
59//# sourceMappingURL=color-registry.js.map
\No newline at end of file