This example should get you up and running ...
This script is for the "Yellow" code at Q6 (assuming it is item 1 in your list at Q6 - change "Q6_1" to what ever the yellow code is). Place this script in the footer of Q6.
I have assumed Q6 is also a multi-response type question.
<script>
if ("[%Q1_4%]"==1 || "[%Q1_6%]"==1 || "[%Q1_7%]"==1 || "[%Q2_4%]"==1 || "[%Q2_6%]"==1 || "[%Q2_7%]"==1 || "[%Q3_4%]"==1 || "[%Q3_6%]"==1 || "[%Q3_7%]"==1 || "[%Q4_4%]"==1 || "[%Q4_6%]"==1 || "[%Q4_7%]"==1 || "[%Q5_4%]"==1 || "[%Q5_6%]"==1 || "[%Q5_7%]"==1)
{
SSI_SetSelect("Q6_1", true);
}
</script>
Apply the same approach to the "Green" code at Q6.