How to change the extension's color with change color theme in theia

when I write extension with theia,And when the color theme change, I want the extension’s widget color will be changed,how to do?thx

[original thread by oyo]

Are they custom colors?

One can contribute new colors by implementing ColorContribution contribution point and calling ColorRegistry.register. It’s important that new colors are derived from existing VS Code colors if one plans to allow installation of VS Code extension contributing color themes. Otherwise, there is no guarantee that new colors don’t look alien for a random VS Code color theme. One can derive from an existing color, just by plainly referencing it, e.g. dark: ‘widget.shadow’, or applying transformations, e.g. dark: Color.lighten(‘widget.shadow’, 0.4).

One can though specify values, without deriving from VS Code colors, for new colors in their own theme. See for example, how Light (Theia) theme overrides colors for the activity bar: https://github.com/eclipse-theia/theia/blob/master/packages/monaco/data/monaco-themes/vscode/light_theia.json

Our theming guidelines: https://github.com/eclipse-theia/theia/wiki/Coding-Guidelines#theming