Build plugin UI components compatible with light and dark modes

Answered

I'm developing a simple idea plug-in. In this plug-in, toolwindow will host my form. I want to know how to set colors for the form. For example, for a text, I want it to be displayed in blue under the light theme and yellow under the darula theme. How should I do it in a standardized way. In addition, I want to add some beautiful components on the idea in the form. Can you give me some help or guidance?

thanks

1 comment
Comment actions Permalink

Hi,

  1. For defining your colors, use JBColor class which holds 2 colors (for light and dark themes).
  2. For images and icons, see https://plugins.jetbrains.com/docs/intellij/work-with-icons-and-images.html
  3. If your components need more advanced logic based on the theme, you can use UIUtil.isUnderDarcula() to detect a dark theme.
0

Please sign in to leave a comment.