Skip to content

Instantly share code, notes, and snippets.

@DeflateAwning
Created May 12, 2021 21:31
Show Gist options
  • Save DeflateAwning/d8d7033094557ea8dc45393aa50fac72 to your computer and use it in GitHub Desktop.
Save DeflateAwning/d8d7033094557ea8dc45393aa50fac72 to your computer and use it in GitHub Desktop.
Random Color =
VAR minColorVal = 128
VAR cR =
RANDBETWEEN ( minColorVal, 255 )
VAR cG =
RANDBETWEEN ( minColorVal, 255 )
VAR cB =
RANDBETWEEN ( minColorVal, 255 )
VAR RedP0 =
MOD ( cR, 16 )
VAR RedP1 =
MOD ( INT ( cR / 16 ), 16 )
VAR GreenP0 =
MOD ( cG, 16 )
VAR GreenP1 =
MOD ( INT ( cG / 16 ), 16 )
VAR BlueP0 =
MOD ( cB, 16 )
VAR BlueP1 =
MOD ( INT ( cB / 16 ), 16 )
VAR hexTable =
ADDCOLUMNS (
{ RedP1, RedP0, GreenP1, GreenP0, BlueP1, BlueP0 },
"Hex", SWITCH (
[Value],
10, "A",
11, "B",
12, "C",
13, "D",
14, "E",
15, "F",
[Value]
)
)
RETURN
"#" & CONCATENATEX ( hexTable, [Hex], "" )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment