Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 83111

This tag is for challenges related to hexadecimal, or base 16, a number system that often uses the digits 0 ‐ 9 and a ‐ f. Only use this tag on challenges specific to base 16, rather than generic [base-conversion] challenges

0 votes

Better Hex Color Codes for Your Internet

Ruby, 127 bytes c=~/#(.)?(.)?(.)?(.)?(.)?(.)?/ $6?c:'#'+($5?$1+$2+$3+$4+$5*2:$4?$1+$4+$2+$4+$3+$4:$3?$1*2+$2*2+$3*2:$2?($1+$2)*3:$1?$1*6:"0"*6) Try it online!
J-L's user avatar
  • 101
0 votes

Better Hex Color Codes for Your Internet

Ruby, 118 bytes def f c c.sub!'#','' s=c.size t=c[3] s>5?'#'+c:f(s<1?'0':s<2?c*6:s<3?c*3:s<4?c*2:s<5?c[0]+t+c[1]+t+c[2]+t:c+c[-1]) end Try it online!
J-L's user avatar
  • 101