rgbh

Privateunrated

Content

33 lines
{=(COMMENT):Randomizes the RGB value if no argument is provided.}
{=(noValue):range:0-255}
{=(noArgs):{{noValue}},{{noValue}},{{noValue}}}

{=(COMMENT):Returns random RGB if no argument, else the argument.}
{=(RGB):{if({1}==):{noArgs}|{args}}}

{=(COMMENT):Grabs each R, G and B value separately from the argument or the random RGB value.}
{=(Red):{RGB(1):,}}
{=(Green):{RGB(2):,}}
{=(Blue):{RGB(3):,}}

{=(COMMENT):Divides each R, G and B values' first digit by 16; and second digit by modulo 16 to get their remainder.}
{=(hex.Red1):{m:trunc({Red}/16)}}
{=(hex.Red2):{m:trunc({Red}%16)}}

{=(hex.Green1):{m:trunc({Green}/16)}}
{=(hex.Green2):{m:trunc({Green}%16)}}

{=(hex.Blue1):{m:trunc({Blue}/16)}}
{=(hex.Blue2):{m:trunc({Blue}%16)}}

{=(COMMENT):Puts the results of the calculations above in preHex, just for code clarity. Could be condensed in "hex" below.}
{=(preHex):{hex.Red1} {hex.Red2} {hex.Green1} {hex.Green2} {hex.Blue1} {hex.Blue2}}

{=(COMMENT):Replaces the values between 10 and 15 to be replaced by their letter equivalent in hexadecimal. This variable is the final hexadecimal value.}
{=(hex):{join():{replace(10,A):{replace(11,B):{replace(12,C):{replace(13,D):{replace(14,E):{replace(15,F):{preHex}}}}}}}}}

{=(COMMENT):Returns a 100*100 image showing the input color.}
{=(dummyImg):https://dummyimage.com/100x100/{hex}/fff&text=+}

{=(COMMENT):Sets the embed's side color to the input color.}
{embed(color):#{hex}}

Embed

1 line
{"color": 5198940, "author": {"name": "RGB To Hex"}, "footer": {"text": "[p]rgbh (RR,GG,BB)"}, "thumbnail": {"url": "{dummyImg}"}, "description": "**RGB:** `{RGB}`\n**Hex:** `#{hex}`"}
Raw JSON
{
  "id": 195722,
  "created_at": "2022-04-26T10:36:17.178Z",
  "tag_name": "rgbh",
  "nsfw": false,
  "owner_id": "149926720114262016",
  "uses": 7,
  "description": null,
  "restricted": false,
  "shared": false,
  "deleted": false,
  "safe": "unrated",
  "hidden": false,
  "guild_id": "518252334975811604",
  "sharer": "149926720114262016",
  "content": "{=(COMMENT):Randomizes the RGB value if no argument is provided.}\n{=(noValue):range:0-255}\n{=(noArgs):{{noValue}},{{noValue}},{{noValue}}}\n\n{=(COMMENT):Returns random RGB if no argument, else the argument.}\n{=(RGB):{if({1}==):{noArgs}|{args}}}\n\n{=(COMMENT):Grabs each R, G and B value separately from the argument or the random RGB value.}\n{=(Red):{RGB(1):,}}\n{=(Green):{RGB(2):,}}\n{=(Blue):{RGB(3):,}}\n\n{=(COMMENT):Divides each R, G and B values' first digit by 16; and second digit by modulo 16 to get their remainder.}\n{=(hex.Red1):{m:trunc({Red}/16)}}\n{=(hex.Red2):{m:trunc({Red}%16)}}\n\n{=(hex.Green1):{m:trunc({Green}/16)}}\n{=(hex.Green2):{m:trunc({Green}%16)}}\n\n{=(hex.Blue1):{m:trunc({Blue}/16)}}\n{=(hex.Blue2):{m:trunc({Blue}%16)}}\n\n{=(COMMENT):Puts the results of the calculations above in preHex, just for code clarity. Could be condensed in \"hex\" below.}\n{=(preHex):{hex.Red1} {hex.Red2} {hex.Green1} {hex.Green2} {hex.Blue1} {hex.Blue2}}\n\n{=(COMMENT):Replaces the values between 10 and 15 to be replaced by their letter equivalent in hexadecimal. This variable is the final hexadecimal value.}\n{=(hex):{join():{replace(10,A):{replace(11,B):{replace(12,C):{replace(13,D):{replace(14,E):{replace(15,F):{preHex}}}}}}}}}\n\n{=(COMMENT):Returns a 100*100 image showing the input color.}\n{=(dummyImg):https://dummyimage.com/100x100/{hex}/fff&text=+}\n\n{=(COMMENT):Sets the embed's side color to the input color.}\n{embed(color):#{hex}}",
  "embed": "{\"color\": 5198940, \"author\": {\"name\": \"RGB To Hex\"}, \"footer\": {\"text\": \"[p]rgbh (RR,GG,BB)\"}, \"thumbnail\": {\"url\": \"{dummyImg}\"}, \"description\": \"**RGB:** `{RGB}`\\n**Hex:** `#{hex}`\"}",
  "last_fetched": "2026-10-20T21:33:42.964Z"
}