Class IntelliJTheme


  • public class IntelliJTheme
    extends java.lang.Object
    This class supports loading IntelliJ .theme.json files and using them as a Laf. .theme.json files are used by Theme plugins for IntelliJ IDEA and other JetBrains IDEs that are based on IntelliJ platform. Here you can find IntelliJ Theme plugins: https://plugins.jetbrains.com/search?tags=Theme The IntelliJ .theme.json file are documented here: http://www.jetbrains.org/intellij/sdk/docs/reference_guide/ui_themes/themes_customize.html
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  IntelliJTheme.ThemeLaf  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.lang.String author  
      private static java.util.Map<java.lang.String,​java.lang.String> checkboxDuplicateColors  
      private static java.util.Map<java.lang.String,​java.lang.String> checkboxKeyMapping  
      private java.util.Map<java.lang.String,​java.lang.String> colors  
      boolean dark  
      private java.util.Map<java.lang.String,​java.lang.Object> icons  
      private boolean isMaterialUILite  
      java.lang.String name  
      private java.util.Map<java.lang.String,​javax.swing.plaf.ColorUIResource> namedColors  
      private java.util.Map<java.lang.String,​java.lang.Object> ui  
      private static java.util.Map<java.lang.String,​java.lang.String> uiKeyCopying
      Copy UI default keys (value --> key).
      private static java.util.Set<java.lang.String> uiKeyDoNotOverride  
      private static java.util.Set<java.lang.String> uiKeyExcludes  
      private static java.util.Map<java.lang.String,​java.lang.String> uiKeyInverseMapping  
      private static java.util.Map<java.lang.String,​java.lang.String> uiKeyMapping
      Rename UI default keys (key --> value).
    • Constructor Summary

      Constructors 
      Constructor Description
      IntelliJTheme​(java.io.InputStream in)
      Loads a IntelliJ .theme.json file from the given input stream.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      private void apply​(java.lang.String key, java.lang.Object value, javax.swing.UIDefaults defaults, java.util.ArrayList<java.lang.Object> defaultsKeysCache, java.util.Set<java.lang.String> uiKeys)
      http://www.jetbrains.org/intellij/sdk/docs/reference_guide/ui_themes/themes_customize.html#custom-ui-control-colors
      private void applyCheckBoxColors​(javax.swing.UIDefaults defaults)
      Because IDEA uses SVGs for check boxes and radio buttons, the colors for these two components are specified in "icons > ColorPalette".
      private void applyColorPalette​(javax.swing.UIDefaults defaults)  
      private void applyProperties​(javax.swing.UIDefaults defaults)  
      private void copyIfNotSet​(javax.swing.UIDefaults defaults, java.lang.String destKey, java.lang.String srcKey, java.util.Set<java.lang.String> uiKeys)  
      static FlatLaf createLaf​(IntelliJTheme theme)
      Creates a Laf instance for the given IntelliJ theme.
      static FlatLaf createLaf​(java.io.InputStream in)
      Loads a IntelliJ .theme.json file from the given input stream and creates a Laf instance for it.
      private java.lang.String fixColorIfValid​(java.lang.String newColorStr, java.lang.String colorStr)  
      private java.lang.Object get​(javax.swing.UIDefaults defaults, java.util.Map<java.lang.Object,​java.lang.Object> themeSpecificDefaults, java.lang.String key)  
      static boolean install​(java.io.InputStream in)
      Deprecated.
      use setup(InputStream) instead; this method will be removed in a future version
      private void loadNamedColors​(javax.swing.UIDefaults defaults)
      http://www.jetbrains.org/intellij/sdk/docs/reference_guide/ui_themes/themes_customize.html#defining-named-colors
      private javax.swing.plaf.ColorUIResource parseColor​(java.lang.String value)  
      private void putAll​(javax.swing.UIDefaults defaults, java.lang.Object value, java.lang.String... keys)  
      private java.util.Map<java.lang.Object,​java.lang.Object> removeThemeSpecificDefaults​(javax.swing.UIDefaults defaults)  
      static boolean setup​(java.io.InputStream in)
      Loads a IntelliJ .theme.json file from the given input stream, creates a Laf instance for it and sets it up.
      private javax.swing.plaf.ColorUIResource toColor​(java.lang.String value)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • name

        public final java.lang.String name
      • dark

        public final boolean dark
      • author

        public final java.lang.String author
      • isMaterialUILite

        private final boolean isMaterialUILite
      • colors

        private java.util.Map<java.lang.String,​java.lang.String> colors
      • ui

        private java.util.Map<java.lang.String,​java.lang.Object> ui
      • icons

        private java.util.Map<java.lang.String,​java.lang.Object> icons
      • namedColors

        private java.util.Map<java.lang.String,​javax.swing.plaf.ColorUIResource> namedColors
      • uiKeyExcludes

        private static final java.util.Set<java.lang.String> uiKeyExcludes
      • uiKeyDoNotOverride

        private static final java.util.Set<java.lang.String> uiKeyDoNotOverride
      • uiKeyMapping

        private static final java.util.Map<java.lang.String,​java.lang.String> uiKeyMapping
        Rename UI default keys (key --> value).
      • uiKeyCopying

        private static final java.util.Map<java.lang.String,​java.lang.String> uiKeyCopying
        Copy UI default keys (value --> key).
      • uiKeyInverseMapping

        private static final java.util.Map<java.lang.String,​java.lang.String> uiKeyInverseMapping
      • checkboxKeyMapping

        private static final java.util.Map<java.lang.String,​java.lang.String> checkboxKeyMapping
      • checkboxDuplicateColors

        private static final java.util.Map<java.lang.String,​java.lang.String> checkboxDuplicateColors
    • Constructor Detail

      • IntelliJTheme

        public IntelliJTheme​(java.io.InputStream in)
                      throws java.io.IOException
        Loads a IntelliJ .theme.json file from the given input stream. The input stream is automatically closed. Using a buffered input stream is not necessary.
        Throws:
        java.io.IOException
    • Method Detail

      • setup

        public static boolean setup​(java.io.InputStream in)
        Loads a IntelliJ .theme.json file from the given input stream, creates a Laf instance for it and sets it up. The input stream is automatically closed. Using a buffered input stream is not necessary.
        Since:
        1.2
      • install

        @Deprecated
        public static boolean install​(java.io.InputStream in)
        Deprecated.
        use setup(InputStream) instead; this method will be removed in a future version
      • createLaf

        public static FlatLaf createLaf​(java.io.InputStream in)
                                 throws java.io.IOException
        Loads a IntelliJ .theme.json file from the given input stream and creates a Laf instance for it. The input stream is automatically closed. Using a buffered input stream is not necessary.
        Throws:
        java.io.IOException
      • createLaf

        public static FlatLaf createLaf​(IntelliJTheme theme)
        Creates a Laf instance for the given IntelliJ theme.
      • applyProperties

        private void applyProperties​(javax.swing.UIDefaults defaults)
      • get

        private java.lang.Object get​(javax.swing.UIDefaults defaults,
                                     java.util.Map<java.lang.Object,​java.lang.Object> themeSpecificDefaults,
                                     java.lang.String key)
      • putAll

        private void putAll​(javax.swing.UIDefaults defaults,
                            java.lang.Object value,
                            java.lang.String... keys)
      • removeThemeSpecificDefaults

        private java.util.Map<java.lang.Object,​java.lang.Object> removeThemeSpecificDefaults​(javax.swing.UIDefaults defaults)
      • loadNamedColors

        private void loadNamedColors​(javax.swing.UIDefaults defaults)
        http://www.jetbrains.org/intellij/sdk/docs/reference_guide/ui_themes/themes_customize.html#defining-named-colors
      • apply

        private void apply​(java.lang.String key,
                           java.lang.Object value,
                           javax.swing.UIDefaults defaults,
                           java.util.ArrayList<java.lang.Object> defaultsKeysCache,
                           java.util.Set<java.lang.String> uiKeys)
        http://www.jetbrains.org/intellij/sdk/docs/reference_guide/ui_themes/themes_customize.html#custom-ui-control-colors
      • fixColorIfValid

        private java.lang.String fixColorIfValid​(java.lang.String newColorStr,
                                                 java.lang.String colorStr)
      • applyColorPalette

        private void applyColorPalette​(javax.swing.UIDefaults defaults)
      • toColor

        private javax.swing.plaf.ColorUIResource toColor​(java.lang.String value)
      • parseColor

        private javax.swing.plaf.ColorUIResource parseColor​(java.lang.String value)
      • applyCheckBoxColors

        private void applyCheckBoxColors​(javax.swing.UIDefaults defaults)
        Because IDEA uses SVGs for check boxes and radio buttons, the colors for these two components are specified in "icons > ColorPalette". FlatLaf uses vector icons and expects colors for the two components in UI defaults.
      • copyIfNotSet

        private void copyIfNotSet​(javax.swing.UIDefaults defaults,
                                  java.lang.String destKey,
                                  java.lang.String srcKey,
                                  java.util.Set<java.lang.String> uiKeys)