3 Replies Latest reply on Jan 11, 2016 12:27 PM by littlehorse3

    How to decect current color theme?

    littlehorse3 Level 1

      Hello. My script create a window in Photoshop and I need to know current color theme (Edit->Preferences->Interface->Color Theme).

      It's very important for me because I need to know what icons I must show on my window, dark or lighten.

      Thank you.

        • 1. Re: How to decect current color theme?
          c.pfaffenbichler Level 9

          There seems to be a lot of interface stuff …

          Key 14 = interfaceWhite: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 15 = interfaceButtonUpFill: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 16 = interfaceBevelShadow: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 17 = interfaceIconFillActive: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 18 = interfaceIconFillDimmed: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 19 = interfacePaletteFill: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 20 = interfaceIconFrameDimmed: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 21 = interfaceIconFrameActive: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 22 = interfaceBevelHighlight: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 23 = interfaceButtonDownFill: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 24 = interfaceIconFillSelected: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 25 = interfaceBorder: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 26 = interfaceButtonDarkShadow: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 27 = interfaceIconFrameSelected: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 28 = interfaceRed: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 29 = interfaceBlack: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 30 = interfaceToolTipBackground: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 31 = interfaceToolTipText: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 32 = interfaceTransparencyForeground: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 33 = interfaceTransparencyBackground: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 34 = interfaceOWLPaletteFill: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 35 = interfaceButtonText: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 36 = interfaceCanvasColor: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 37 = interfaceStaticText: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

          Key 38 = interfaceButtonShadow: DescValueType.OBJECTTYPE

          [ActionDescriptor]_interfaceColor

           

          Maybe this one is of interest?

          // based on code by michael l hale;

          // 2016, use it at your own risk;

          #target "photoshop-90.032"

          var ref = new ActionReference();

          ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );

          var applicationDesc = executeActionGet(ref);

          checkDesc2(applicationDesc.getObjectValue(stringIDToTypeID("interfacePaletteFill")));

          ////////////////////////////////////

          ////// based on code by michael l hale //////

          function checkDesc2 (theDesc) {

          var c = theDesc.count;

          var str = '';

          for(var i=0;i<c;i++){ //enumerate descriptor's keys

            str = str + 'Key '+i+' = '+typeIDToStringID(theDesc.getKey(i))+': '+theDesc.getType(theDesc.getKey(i))+'\n'+getValues (theDesc, i)+'\n';

            };

          alert("desc\n\n"+str);

          };

          ////// check //////

          function getValues (theDesc, theNumber) {

          switch (theDesc.getType(theDesc.getKey(theNumber))) {

          case DescValueType.ALIASTYPE:

          return theDesc.getPath(theDesc.getKey(theNumber));

          break;

          case DescValueType.BOOLEANTYPE:

          return theDesc.getBoolean(theDesc.getKey(theNumber));

          break;

          case DescValueType.CLASSTYPE:

          return theDesc.getClass(theDesc.getKey(theNumber));

          break;

          case DescValueType.DOUBLETYPE:

          return theDesc.getDouble(theDesc.getKey(theNumber));

          break;

          case DescValueType.ENUMERATEDTYPE:

          return (typeIDToStringID(theDesc.getEnumerationValue(theDesc.getKey(theNumber)))+"_"+typeIDToStr ingID(theDesc.getEnumerationType(theDesc.getKey(theNumber))));

          break;

          case DescValueType.INTEGERTYPE:

          return theDesc.getInteger(theDesc.getKey(theNumber));

          break;

          case DescValueType.LISTTYPE:

          return theDesc.getList(theDesc.getKey(theNumber));

          break;

          case DescValueType.OBJECTTYPE:

          return (theDesc.getObjectValue(theDesc.getKey(theNumber))+"_"+typeIDToStringID(theDesc.getObject Type(theDesc.getKey(theNumber))));

          break;

          case DescValueType.RAWTYPE:

          return theDesc.getReference(theDesc.getData(theNumber));

          break;

          case DescValueType.REFERENCETYPE:

          return theDesc.getReference(theDesc.getKey(theNumber));

          break;

          case DescValueType.STRINGTYPE:

          return theDesc.getString(theDesc.getKey(theNumber));

          break;

          case DescValueType.UNITDOUBLE:

          return (theDesc.getUnitDoubleValue(theDesc.getKey(theNumber))+"_"+typeIDToStringID(theDesc.getUn itDoubleType(theDesc.getKey(theNumber))));

          break;

          default:

          break;

          };

          };

          • 2. Re: How to decect current color theme?
            SuperMerlin Level 5

            This works with CS6.

             

            function colourScheme(){
            var ref = new ActionReference();
            ref.putProperty( charIDToTypeID("Prpr"), stringIDToTypeID("interfacePrefs") );
            ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
            var desc = executeActionGet(ref).getObjectValue(stringIDToTypeID("interfacePrefs"));
            return typeIDToStringID(desc.getEnumerationValue( stringIDToTypeID( "kuiBrightnessLevel" )));
            };
            alert(colourScheme());
            
            
            
            • 3. Re: How to decect current color theme?
              littlehorse3 Level 1

              This function crushed CC 2014 (I don't need it where), but works in CC 2015! Thank you very much!