# I want to set the Grating color individually

**URL:** <https://discourse.psychopy.org/t/i-want-to-set-the-grating-color-individually/31852>\
**Category:** Coding\
**Created:** [November 10, 2022, 3:34am UTC](https://discourse.psychopy.org/t/i-want-to-set-the-grating-color-individually/31852 "2022-11-10T03:34:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![k\_moto](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/k_moto/32/36051_2.png) [@k\_moto](https://discourse.psychopy.org/u/k_moto)\
**Post date:** [November 10, 2022, 3:34am UTC](https://discourse.psychopy.org/t/i-want-to-set-the-grating-color-individually/31852/1 "2022-11-10T03:34:38Z")

</div>

I am trying to do research on color motion.  
I would like to create an R-G grating and obtain motion aftereffects. However, the current psychopy specification allows only one color to be specified, but the second color is automatically set to the opposite color.

I would like to define a second color for grating like psychotoolbox.

In addition, I would like to have the motion by phase shift.

I do not have an idea to solve this problem with my technology😂.  
Thank you in advance for your help.

---

<div class="post-metadata">

**Author:** ![jonathan.kominsky](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jonathan.kominsky](https://discourse.psychopy.org/u/jonathan.kominsky)\
**Post date:** [November 11, 2022, 9:28am UTC](https://discourse.psychopy.org/t/i-want-to-set-the-grating-color-individually/31852/2 "2022-11-11T09:28:07Z")

</div>

Try messing around with the ‘contrast’ argument when creating your GratingStim. It just functions as a modifier on the foreColor argument, so you can’t name your contrast color directly, but with a little fine-tuning you should be able to get most color options out of it.

---

<div class="post-metadata">

**Author:** ![Kimberley\_Dundas](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/kimberley_dundas/32/32322_2.png) [@Kimberley\_Dundas](https://discourse.psychopy.org/u/Kimberley_Dundas)\
**Post date:** [November 12, 2022, 7:30am UTC](https://discourse.psychopy.org/t/i-want-to-set-the-grating-color-individually/31852/3 "2022-11-12T07:30:47Z")

</div>

Hi there,

You can also use an image as the texture for your grating stimulus.

For the motion you can set the phase to be t\*3 for example, depending on the speed you want. t is a clock that exists in PsychoPy that is the time since the routine started in seconds.

There’s information on this and more [here](https://www.psychopy.org/builder/components/grating.html).
