Output the HTML colors
Jelly, 31 29 27 bytes
“×Ɗ¡‘ŒP»Ṫ¦209ṗ€3Fd⁴ịØHs3ṢQY
Try it online!
How it works
“×Ɗ¡‘
yield the code points of the characters between the quotes in Jelly's SBCS, which are 0x11 = 17, 0x91 = 145, and 0x00 = 0.
ŒP
constructs the powerset of the array of code points, yielding
[[], [17], [145], [0], [17, 145], [17, 0], [145, 0], [17, 145, 0]]
The last two entries correspond to combinations that contain both 80 and FF, so we have to discard them.
»Ṫ¦209
consists of three parts:
Ṫ
(tail) removes the last array of code points, i.e., [17, 145, 0].»209
takes the maximum of each integer in the remainder of the powerset and 0xD1 = 209, replacing all of them with 209.¦
(sparse) iterates over the elements of the remainder of the powerset. If the corresponding index is found in [17, 145, 0], the element is replaced with all 209's. If not, it is left untouched.¦
isn't modular, so this modifies only the last array (index 0) in the remainder of the powerset. The indices 17 and 145 are too large and have no effect.
The result is as follows.
[[], [17], [145], [0], [17, 145], [17, 0], [209, 209]]
ṗ€3
computes the third Cartesian power of each array, i.e., the array of all 3-tuples of elements of each array.
Fd⁴
flattens the result and computes quotient and remainder of each integer divided by 16.
ịØH
indexes (1-based) into "0123456789ABCDEF, so 0x11, 0x91, 0x00, and 0xD1 get mapped to "00", "80", "FF", and "C0" (resp.).
s3ṢQ
splits the character pairs into 3-tuples, sorts the tuples, and deduplicates.
Finally, Y
joins the unique tuples, separating by linefeeds.
Bash + GNU Utilities, 67
- 2 bytes saved thanks to @manatwork
- 2 bytes saved thanks to @zeppelin
a={00,80,FF}
eval echo $a$a$a|fmt -w9|sed '16iC0C0C0
/F0*8\|80*F/d'
- The brace expansion
{00,80,FF}{00,80,FF}{00,80,FF}
gives all need combinations in the right order (excludingC0C0C0
), along some extras. The extras are the ones that contain bothF
and8
characters. - The result of the brace expansion is a single space-separated line.
fmt
puts each entry on its own line - The 1st line of the
sed
expression insertsC0C0C0
in the appropriate line - The 2nd line of the
sed
expression filters out the "extras" described above.
Ideone.
Jelly, 38 31 bytes
“mạ9ṣṃwɠƁ,¡ẓw’b4µża1$ị“08CF”s3Y
TryItOnline!
Base 250 compression of a number (“...’
),
converted to base 4 (b4
),
zipped (ż
) with a copy of itself after a vectorised logical-and with 1 (a1$
)*,
indexed (ị
) into the four characters used (“08CF”
),
split into chunks of length 3 (s3
),
and joined with line feeds (Y
).
* Thus pairing each zero digit with another zero and each of any other digits with a one. Along with the following indexed fetch this means 'F'
becomes paired with another 'F'
while '0'
,'8'
, and 'C'
each pair with a '0'
.