Color Field

Simple Queries

Sample Color Query HEX

{
categories {
color {
hex
}
}
}

Output

{
"data": {
"categories": [
{
"color": {
"hex": "#3d1702"
}
}
]
}
}

Sample Color Query CSS

{
categories {
color {
css
}
}
}

Output

{
"data": {
"categories": [
{
"color": {
"css": "rgb(61,23,2)"
}
}
]
}
}

Sample Color Query RGBA

{
categories {
color {
rgba {
r
g
b
a
}
}
}
}

Output

{
"data": {
"categories": [
{
"color": {
"rgba": {
"r": 61,
"g": 23,
"b": 2,
"a": 1
}
}
}
]
}
}

Mutating a Color

Mutating a color takes either a HEX value or {r,g,b,a} input. If both are provided, {r,g,b,a} takes presedence.

Mutation by HEX Value

mutation {
createCategory(data: { hex: "#1a1a1a" }) {
color
}
}

Output

{
"data": {
"createCategory": {
"color": {
"hex": "#1a1a1a"
}
}
}
}

Mutation by RGBA Value

RGB values are on a scale from 0 - 255. Alpha values are on a scale from 0 to 1. All values are required.

mutation {
createCategory(data: { color: { rgba: { r: 25, g: 25, b: 25, a: 1 } } }) {
color {
rgba {
r
g
b
a
}
}
}
}

Output

{
"data": {
"createCategory": {
"color": {
"rgba": {
"r": 25,
"g": 25,
"b": 25,
"a": 1
}
}
}
}
}

This site uses cookies to provide you with a better user experience. For more information, refer to our Privacy Policy