vscode#ColorThemeKind TypeScript Examples

The following examples show how to use vscode#ColorThemeKind. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: webview.ts    From cloudmusic-vscode with MIT License 6 votes vote down vote up
private static _layout(title: string, css: string, js: string) {
    const nonce = getNonce();
    return `
<!DOCTYPE html>
<html
  lang="en"
  ${window.activeColorTheme.kind === ColorThemeKind.Light ? "" : 'class="dark"'}
>
  <head>
    <meta name="viewport" content="width=device-width,initial-scale=1" />
    <title>${title}</title>
    <link rel="stylesheet" type="text/css" href=${css} />
  </head>
  <body>
    <div id="root"></div>
  </body>
  <script type="module" src=${js} nonce=${nonce}></script>
</html>`;
  }
Example #2
Source File: add-server.ts    From vscode-q with MIT License 5 votes vote down vote up
private configure(): void {
        let isLightTheme = false;
        isLightTheme = window.activeColorTheme.kind === ColorThemeKind.Light;
        this._theme = isLightTheme ? '' : '-dark';
    }
Example #3
Source File: chart-viewer.ts    From vscode-q with MIT License 5 votes vote down vote up
private configure(): void {
        let isLightTheme = false;
        isLightTheme = window.activeColorTheme.kind === ColorThemeKind.Light;
        this._theme = isLightTheme ? '' : '-dark';
    }
Example #4
Source File: query-grid.ts    From vscode-q with MIT License 5 votes vote down vote up
private configure(): void {
        let isLightTheme = false;
        isLightTheme = window.activeColorTheme.kind === ColorThemeKind.Light;
        this._theme = isLightTheme ? '' : '-dark';
        this._keyColor = isLightTheme ? '#E1BEE7' : '#6A1B9A';
    }
Example #5
Source File: query-view.ts    From vscode-q with MIT License 5 votes vote down vote up
private configure(): void {
        let isLightTheme = false;
        isLightTheme = window.activeColorTheme.kind === ColorThemeKind.Light;
        this._theme = isLightTheme ? '' : '-dark';
        this._keyColor = isLightTheme ? '#E1BEE7' : '#6A1B9A';
        this._dataViewBg = isLightTheme ? '#eeeeee' : this._dataViewBg;
    }
Example #6
Source File: q-status-bar-manager.ts    From vscode-q with MIT License 5 votes vote down vote up
private isLightTheme = window.activeColorTheme.kind === ColorThemeKind.Light;
Example #7
Source File: colors.ts    From vscode-todo-md with MIT License 5 votes vote down vote up
/**
 * Get color ,ideally, depending on theme light/dark.
 */
export function helpGetColor(colorName: keyof typeof colors) {
	return window.activeColorTheme.kind === ColorThemeKind.Dark ? colors[colorName].dark : colors[colorName].light;
}
Example #8
Source File: webview.ts    From cloudmusic-vscode with MIT License 4 votes vote down vote up
resolveWebviewView(
    webview: WebviewView
    // context: WebviewViewResolveContext
    // token: CancellationToken
  ): void {
    const extUri = AccountViewProvider.context.extensionUri;
    AccountViewProvider._view = webview;

    webview.title = i18n.word.account;
    webview.webview.options = {
      enableScripts: true,
      localResourceRoots: [extUri, Uri.file(SETTING_DIR)],
    };

    webview.webview.onDidReceiveMessage((msg: ProviderCMsg) => {
      switch (msg.command) {
        case "pageLoaded":
          AccountViewProvider.master();
          AccountViewProvider.account([...AccountManager.accounts.values()]);
          AccountViewProvider.metadata();
          AccountViewProvider.wasmVolume(
            AccountViewProvider.context.globalState.get(VOLUME_KEY, 85)
          );
          AccountViewProvider.wasmSpeed(
            AccountViewProvider.context.globalState.get(SPEED_KEY, 1)
          );

          if (State.wasm) {
            const audioUri = Uri.joinPath(extUri, "media", "audio");
            workspace.fs.readDirectory(audioUri).then((items) => {
              const files = items
                .filter(([name]) => name.startsWith("silent"))
                .map(([name]) =>
                  webview.webview
                    .asWebviewUri(Uri.joinPath(audioUri, name))
                    .toString()
                );
              const msg: ProviderSMsg = { command: "test", files };
              void webview.webview.postMessage(msg);
            }, console.error);
            State.downInit(); // 3
          }
          break;
        case "account":
          AccountManager.accountQuickPick(msg.userId);
          break;
        case "end":
          if (State.repeat) IPC.load();
          else void commands.executeCommand("cloudmusic.next");
          break;
        case "load":
          IPC.loaded();
          break;
        case "position":
          IPC.position(msg.pos);
          break;
        case "playing":
          IPC.playing(msg.playing);
          break;
        default:
          void commands.executeCommand(`cloudmusic.${msg.command}`);
          break;
      }
    });

    const js = webview.webview
      .asWebviewUri(Uri.joinPath(extUri, "dist", "provider.js"))
      .toString();
    const css = webview.webview
      .asWebviewUri(Uri.joinPath(extUri, "dist", "style.css"))
      .toString();

    webview.webview.html = `
<!DOCTYPE html>
<html
  lang="en"
  ${window.activeColorTheme.kind === ColorThemeKind.Light ? "" : 'class="dark"'}
>
  <head>
    <meta name="viewport" content="width=device-width,initial-scale=1" />
    <title>${i18n.word.account}</title>
    <link rel="stylesheet" type="text/css" href=${css} />
  </head>
  <body>
    <div id="root"></div>
  </body>
  <script>window.enablePlayer=${State.wasm ? "true" : "false"}</script>
  <script type="module" src=${js} nonce=${getNonce()}></script>
</html>`;
  }