# "$Grn " vs. "grain"

**URL:** <https://forums.creativeclouddeveloper.com/t/grn-vs-grain/4107>\
**Category:** Photoshop\
**Created:** [January 5, 2022, 4:56pm UTC](https://forums.creativeclouddeveloper.com/t/grn-vs-grain/4107 "2022-01-05T16:56:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AnthonyK](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@AnthonyK](https://forums.creativeclouddeveloper.com/u/AnthonyK)\
**Post date:** [January 5, 2022, 4:56pm UTC](https://forums.creativeclouddeveloper.com/t/grn-vs-grain/4107/1 "2022-01-05T16:56:47Z")

</div>

I was looking through some older batchPlay code that I thought was generated by Alchemist (though not entirely sure) and came across some code that used `"$Grn "` to designate green. This seemed odd relative to the designation for the other colors. The example below is for making a Black and White adjustment layer.

```auto
//Make Black and White adjustment layer
{
   "_obj": "make",
   "_target": [
      {
         "_ref": "adjustmentLayer"
      }
   ],
   "using": {
      "_obj": "adjustmentLayer",
      "type": {
         "_obj": "blackAndWhite",
         "presetKind": {
            "_enum": "presetKindType",
            "_value": "presetKindDefault"
         },
         "red": 40,
         "yellow": 60,
         "$Grn ": 40,
         "cyan": 60,
         "blue": 20,
         "magenta": 80,
         "useTint": false,
         "tintColor": {
            "_obj": "RGBColor",
            "red": 225.00045776367188,
            "grain": 211.00067138671875,
            "blue": 179.00115966796875
         }
      }
   },
   "_isCommand": true
}; 

```

I checked Alchemist yesterday for the code and now get the following where `"$Grn "` has been replaced by `"grain"`, which actually makes more sense.

```auto
//Make Black and White adjustment layer
{
   "_obj": "make",
   "_target": [
      {
         "_ref": "adjustmentLayer"
      }
   ],
   "using": {
      "_obj": "adjustmentLayer",
      "type": {
         "_obj": "blackAndWhite",
         "presetKind": {
            "_enum": "presetKindType",
            "_value": "presetKindDefault"
         },
         "red": 40,
         "yellow": 60,
         "grain": 40,
         "cyan": 60,
         "blue": 20,
         "magenta": 80,
         "useTint": false,
         "tintColor": {
            "_obj": "RGBColor",
            "red": 225.00045776367188,
            "grain": 211.00067138671875,
            "blue": 179.00115966796875
         }
      }
   },
   "_isCommand": true
}

```

It seems like both `"$Grn "` and `"grain"` work, but I wonder if one is more correct and should be used, especially given that `$Grn "` is unusual compared to the other color designations. I wonder where the `"$Grn "` name actually came from. It seems to be an outlier.

---

<div class="post-metadata">

**Author:** ![Karmalakas](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/karmalakas/32/1048_2.png) [@Karmalakas](https://forums.creativeclouddeveloper.com/u/Karmalakas)\
**Post date:** [January 5, 2022, 9:21pm UTC](https://forums.creativeclouddeveloper.com/t/grn-vs-grain/4107/2 "2022-01-05T21:21:12Z")

</div>

Here’s a nice explanation from @simonhenke

> [@How to get, set and unset layer color?](http://forums.creativeclouddeveloper.com/t/how-to-get-set-and-unset-layer-color/2281/3):
>
> Those color names are correct. They originate from mistakes that were done many years ago, for example the grain/green thing exists due to the accidental double assignment of the char-code "Grn ". There is no documentation on every single internal property of Photoshop that you can target via BatchPlay, however I started to create Typescript types for some stuff, where you can also see the [ColorNames](https://github.com/simonhenke/photoshop-types/blob/5d513f21f14e54e16acdc377e1efe1b23ed1c921/types/Color.d.ts#L45-L55). You can’t really directly mix BatchPlay and DOM code, but you can get the id from a layer obj…

---

<div class="post-metadata">

**Author:** ![Jarda](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/jarda/32/1909_2.png) [@Jarda](https://forums.creativeclouddeveloper.com/u/Jarda)\
**Post date:** [January 7, 2022, 1:37pm UTC](https://forums.creativeclouddeveloper.com/t/grn-vs-grain/4107/3 "2022-01-07T13:37:53Z")

</div>

They both have exactly the same typeID number. Alchemist for conversion from .ATN file into batchplay uses this [alchemist/CharIDToStringID.ts at master · jardicc/alchemist · GitHub](https://github.com/jardicc/alchemist/blob/master/src/atnDecoder/classes/CharIDToStringID.ts)

Otherwise, you could have much more strings like that and it would be more confusing. I think these might be preferable in .ATN files because are shorter and save space.

---

<div class="post-metadata">

**Author:** ![AnthonyK](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@AnthonyK](https://forums.creativeclouddeveloper.com/u/AnthonyK)\
**Post date:** [January 7, 2022, 10:10pm UTC](https://forums.creativeclouddeveloper.com/t/grn-vs-grain/4107/4 "2022-01-07T22:10:39Z")

</div>

Thanks for that info @Jarda & @Karmalakas . If they have the same typeID, then it’s my understanding they should work equally well for triggering the correct response in Photoshop.
