Changing light color back and forth

I tried making a script that changes the directional light color when i swipe down and changing it back when i swipe up but after changing it back it starts changing back and forth constantly.

Here is the script

    Color color0 ;
    Color color1 ;
    public float duration;
    Light lt;
    bool swipepossible = false;
    private bool swipingdown = false;
    private bool swipingup = false;


    // Update is called once per frame
    void Update()
    {   

        lt = GetComponent<Light>();
        if (lt.color == new Color(255f / 255f, 244f / 255f, 214f / 255f) || lt.color == new Color(45f / 255f, 67f / 255f, 95f / 255f)) swipepossible = true;
        if (SwipeInput.swipedDown && swipepossible)
        {
            swipingdown = true;
        }
        if (SwipeInput.swipedUp && swipepossible)
        {
            swipingup = true;
        }
        if ( swipingdown == true )
        {  
            Change();
        }
        if (swipingup == true)
        {
            ChangeBack();
        }
    }
    private void Change()
    {
        lt = GetComponent<Light>();
        color0 = lt.color;
        color1 = new Color(45f / 255f, 67f / 255f, 95f / 255f);
        if (lt.color != color1)
        {
            float t = Mathf.PingPong(Time.time, duration) / duration;
            lt.color = Color.Lerp(color0, color1, t);
        }
    }
    private void ChangeBack()
    {
        lt = GetComponent<Light>();
        color0 = lt.color;
        color1 = new Color(255f / 255f, 244f / 255f, 214f / 255f);
        if (lt.color != color1)
        {
            float t = Mathf.PingPong(Time.time, duration) / duration;
            lt.color = Color.Lerp(color0, color1, t);
        }
    }

public Gradient Gradient ; // Provide the colors in the inspector
public float Duration;
private Light light;
private float value;
private float targetValue;

private void Start()
{
    light = GetComponent<Light>();
}

// Update is called once per frame
void Update()
{   
    if(value <= Mathf.Epsilon && SwipeInput.swipedUp)
        targetValue = 1;
    else if(value >= 1 - Mathf.Epsilon && SwipeInput.swipedDown)
        targetValue = 0;

    value = Mathf.MoveTowards(value, targetValue, Time.deltaTime / Duration);
    light.color = Gradient.Evaluate(value);
}