---
name: "SDL_DEFINE_COLORSPACE"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_DEFINE_COLORSPACE"
---

# SDL\_DEFINE\_COLORSPACE(3)

A macro for defining custom SDL\_Colorspace formats.

## NAME

SDL\_DEFINE\_COLORSPACE - A macro for defining custom  **SDL\_Colorspace**\
  formats.

## HEADER FILE

Defined in SDL3/SDL\_pixels.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**#define SDL\_DEFINE\_COLORSPACE(type, range, primaries, transfer, matrix, chroma) .BI** *(((Uint32)(type)***\<\<***28)***\|***((Uint32)(range)***\<\<***24)***\|***((Uint32)(chroma)***\<\<***20)***\|***.BI*    **((Uint32)(primaries) \<\< 10) \| ((Uint32)(transfer) \<\< 5) \| ((Uint32)(matrix) \<\< 0))**

## DESCRIPTION

For example, defining  **SDL\_COLORSPACE\_SRGB**\
  looks like this:

-

  ```
  SDL_DEFINE_COLORSPACE(SDL_COLOR_TYPE_RGB,
                        SDL_COLOR_RANGE_FULL,
                        SDL_COLOR_PRIMARIES_BT709,
                        SDL_TRANSFER_CHARACTERISTICS_SRGB,
                        SDL_MATRIX_COEFFICIENTS_IDENTITY,
                        SDL_CHROMA_LOCATION_NONE)
  ```

## RETURN VALUE

Returns a format value in the style of  **SDL\_Colorspace** .

## THREAD SAFETY

It is safe to call this macro from any thread.

## AVAILABILITY

This macro is available since SDL 3.2.0.
