--- tags: Guide, Backend, Greyscale --- # GAGS Layer Types ## Fields available in all layer types > ### [text] `layer_type` The text in this field should be one of the layer types available. * [icon_state](#layer-type-icon_state) * [reference](#layer-type-reference) * [color_matrix](#layer-type-color_matrix) #### Example ```json { "default": [ { "type": "icon_state", "icon_state": "base", "blend_mode": "overlay", "color_ids": [ 1 ] } ] } ``` --- > ### [array] `color_ids` This is an array of number ids corresponding to the colors provided to the greyscale config. You are also allowed to use a text color hex code if you want a static color. #### Example ```json { "default": [ { "type": "reference", "reference_type": "/datum/greyscale_config/cleric_mace", "icon_state": "default", "blend_mode": "overlay", "color_ids": [ 1 ] }, [ { "type": "reference", "reference_type": "/datum/greyscale_config/shimmer", "blend_mode": "overlay", "color_ids": [ "#ffffff" ] }, { "type": "icon_state", "icon_state": "shimmer_mask", "blend_mode": "multiply" } ] ] } ``` --- > ### [text] `blend_mode` This determines how the layer is added on to the in progress generated image. The available options are identical to byond's blend modes and byond's documents should be referenced for details. Available modes: * `add` * `subtract` * `multiply` * `or` * `overlay` * `underlay` #### Example ```json { "default": [ { "type": "icon_state", "icon_state": "base", "blend_mode": "overlay", "color_ids": [ 1 ] }, { "type": "icon_state", "icon_state": "add_shader", "blend_mode": "add" }, { "type": "icon_state", "icon_state": "multi_shader", "blend_mode": "multiply" } ] } ``` --- > ## [layer type] `icon_state` Loads an icon state from the configured dmi then blends it into the in progress image. > ### [text] `icon_state` The specific icon state to load from the dmi. #### Example ```json { "default": [ { "type": "icon_state", "icon_state": "base", "blend_mode": "overlay", "color_ids": [ 1 ] } ] } ``` --- > ## [layer type] `reference` Creates a layer using the output of another greyscale configuration. This allows you to have simplistic base designs that get reused in more complex configurations. > ### [text] `icon_state` The specific icon state from the generated dmi. Defaults to "". --- > ### [text] `reference_type` The typepath of the greyscale configuration to use. #### Example ```json { "default": [ { "type": "reference", "reference_type": "/datum/greyscale_config/cleric_mace", "icon_state": "default", "blend_mode": "overlay", "color_ids": [ 1 ] }, [ { "type": "reference", "reference_type": "/datum/greyscale_config/shimmer", "blend_mode": "overlay", "color_ids": [ "#ffffff" ] }, { "type": "icon_state", "icon_state": "shimmer_mask", "blend_mode": "multiply" } ] ] } ``` --- > ## [layer type] `color_matrix` Allows for color matrix transformations of the image up to that point. This layer creates a copy of the generated icon up to that point, transforms it using `MapColors()`. Check the byond docs for details on how this process works. > ### [matrix] `color_matrix` This is a 4 by 5 multi-dimensional array of numbers that controls how colors are transformed in the newly created layer icon. #### Example ```json { "type": "color_matrix", "blend_mode": "overlay", "color_matrix": [ [0.3, 0.3, 0.3, 0], [0.59, 0.59, 0.59, 0], [0.11, 0.11, 0.11, 0], [0, 0, 0, 1], [0, 0, 0, 0] ] } ``` This layer effectively strips colors from an image and turns it into a greyscale version of itself. When doing this to canisters on the final step for example, you get the following: ![](https://hackmd.io/_uploads/BkKJtbpTh.png)