# ColorTextureAlpha

### Introduction

The ColorTextureAlpha color operation can be used to make an object apply a solid color to all opaque pixels, yet retain its transparency. This can be used to create silhouettes or objects which flash, such as enemies taking damage.

### Code Example - Flashing on Key Press

The following code flashes a Sprite white when the Space key is pressed:

```csharp
if(keyboard.KeyDown(Microsoft.Xna.Framework.Input.Keys.Space))
{
    SpriteInstance.ColorOperation = 
        FlatRedBall.Graphics.ColorOperation.ColorTextureAlpha;
    SpriteInstance.Red = 1;
    SpriteInstance.Green = 1;
    SpriteInstance.Blue = 1;
}
else
{
    SpriteInstance.ColorOperation =
        FlatRedBall.Graphics.ColorOperation.Texture;
}
```

<figure><img src="https://951240982-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fye9Ufg3vzJxwX5Hk%2Fuploads%2FKUoCWxMF6qRkjGSRh4pD%2F20_15%2025%2013.gif?alt=media&#x26;token=62d1c1a5-7b35-45ce-99d6-d29e1b5b9b97" alt=""><figcaption><p>Setting ColorTextureAlpha to flash a sprite white</p></figcaption></figure>
