Documentation Archive

Developer

Asset Catalog Format Reference

On This Page

Named Color Type

The definition for a named color that can be used anywhere you can use a color in your project.

Extension

.colorset

Folder Contents

The Contents.json file.

Contents.json File (Required)

Metadata and attributes for the individual colors for the named color (Table 24-1).

Table 24-1Named color tags

Key

Type

Description

info

Dictionary

Metadata for the author and format version of the asset catalog.

   author

String

Use your bundle ID.

   version

Number

The format version of the asset catalog. Use 1.

colors

Array

Each element identifies one variant of the color.

   display-gamut

Slot component

The color gamut of the device display. For the values, see display-gamut in Image Set Type.

   idiom

Slot Component

The idiom of the icon. For the values, see idiom in Image Set Type.

   color

Dictionary

One of the sizes that matches the idiom for the icon. If the size is not valid, the image is ignored.

For the values, see size below.

      color-space

Slot Component

The color space for the data item. For the values, see color-space in Image Set Type.

      components

Dictionary

The RGBA color components for the named color.

         red

Number

The red component of the custom color specified as a number from 0 to 1.

         green

Number

The green component of the custom color specified as a number from 0 to 1.

         blue

Number

The blue component of the custom color specified as a number from 0 to 1.

         alpha

Number

The transparency of the custom color specified as a number from 0 to 1.

Values for Enumerated Tags

color-space

See color-space in Image Set Type.

display-gamut

See display-gamut in Image Set Type.

idiom

See idiom in Image Set Type.

Sample Contents.json File

  1. {
  2. "colors" : [
  3. {
  4. "idiom" : "universal",
  5. "display-gamut" : "sRGB",
  6. "color" : {
  7.    "components" : {
  8.        "red" : 0.5,
  9.        "green" : 0.5,
  10.        "blue" : 0.5,
  11.       "alpha" : 1
  12.        },
  13.    "color-space" : "srgb"
  14.    },
  15. },
  16. {
  17. "idiom" : "universal",
  18. "display-gamut" : "display-P3",
  19. "color" : {
  20.    "components" : {
  21.        "red" : 0.5,
  22.        "green" : 0.5,
  23.        "blue" : 0.5,
  24.       "alpha" : 1
  25.        },
  26.    "color-space" : "display-p3"
  27.    },
  28. },
  29. ],
  30.   "info" : {
  31.       "author" : "com.developerName",
  32.       "version" : 1
  33.    }
  34. }