API:1/colors

From Guild Wars 2 Wiki
Jump to: navigation, search

/v1/colors.json

HTTP method
GET
Format
json
API version
version 1
Release date
 ?
Scope
none
Optional
none

This resource returns all dyes in the game, including localized names and their color component information.

Parameters

Optional parameters
  • lang – The language to query the names for.

Response

The response is an object with the single property colors which contains an object where color ids are mapped to an object, containing the following properties:

  • name (string) – The name of the dye.
  • base_rgb (list) – The base RGB values.
  • cloth (object) – Detailed information on its appearance when applied on cloth armor.
  • leather (object) – Detailed information on its appearance when applied on leather armor.
  • metal (object) – Detailed information on its appearance when applied on metal armor.

The detailed information object contains the following properties:

  • brightness (number) – The brightness.
  • contrast (number) – The contrast.
  • hue (number) – The hue in the HSL colorspace.
  • saturation (number) – The saturation in the HSL colorspace.
  • lightness (number) – The lightness in the HSL colorspace.
  • rgb (list) – A list containing precalculated RGB values.

Example

https://api.guildwars2.com/v1/colors.json

{
  "colors": {
    "126": {
      "name": "Hot Pink",
      "base_rgb": [ 128, 26, 26 ],
      "cloth": {
        "brightness": 14,
        "contrast": 1.21094,
        "hue": 340,
        "saturation": 0.820313,
        "lightness": 1.44531,
        "rgb": [ 169, 54, 94 ]
      },
      "leather": {
        "brightness": 14,
        "contrast": 1.21094,
        "hue": 340,
        "saturation": 0.703125,
        "lightness": 1.44531,
        "rgb": [ 160, 62, 96 ]
      },
      "metal": {
        "brightness": 14,
        "contrast": 1.21094,
        "hue": 340,
        "saturation": 0.585938,
        "lightness": 1.44531,
        "rgb": [ 151, 69, 98 ]
      }
    },
    
    "20": {
      "name": "Ivory",
      ...
      }
    },
    ...
  }
}
Example by Cliff Spradlin

An example by Cliff on interpreting the HSL colors with contrast and brightness is available here.