#!/bin/bash

# <xbar.title>Lightsalmon</xbar.title>
# <xbar.version>v1.0</xbar.version>
# <xbar.author>Isaac</xbar.author>
# <xbar.author.github>irstacks</xbar.author.github>
# <xbar.desc>Shows all 140 named web colors (sorted). Click copies corresponding hex to your clipboard.</xbar.desc>
# <xbar.image>http://i.imgur.com/YE0P2ww.png</xbar.image>

if [[ "$1" = "copy" ]]; then
  echo "$2" | tr -d '\n' | pbcopy
  osascript -e "display notification \"Copied $2 to Clipboard\" with title \"BitBar colors\"" &> /dev/null
  exit
fi

# List 140 named web colors.
echo "#"
echo "---"
echo "RED |color=RED"
echo "--indianred #CD5C5C (205, 92, 92) | color=#CD5C5C bash='$0' param1=copy param2='#CD5C5C' refresh=false terminal=false"
echo "--lightcoral #F08080 (240, 128, 128) | color=#F08080 bash='$0' param1=copy param2='#F08080' refresh=false terminal=false"
echo "--salmon #FA8072 (250, 128, 114) | color=#FA8072 bash='$0' param1=copy param2='#FA8072' refresh=false terminal=false"
echo "--darksalmon #E9967A (233, 150, 122) | color=#E9967A bash='$0' param1=copy param2='#E9967A' refresh=false terminal=false"
echo "--lightsalmon #FFA07A (255, 160, 122) | color=#FFA07A bash='$0' param1=copy param2='#FFA07A' refresh=false terminal=false"
echo "--crimson #DC143C (220, 20, 60) | color=#DC143C bash='$0' param1=copy param2='#DC143C' refresh=false terminal=false"
echo "--red #FF0000 (255, 0, 0) | color=#FF0000 bash='$0' param1=copy param2='#FF0000' refresh=false terminal=false"
echo "--firebrick #B22222 (178, 34, 34) | color=#B22222 bash='$0' param1=copy param2='#B22222' refresh=false terminal=false"
echo "--darkred #8B0000 (139, 0, 0) | color=#8B0000 bash='$0' param1=copy param2='#8B0000' refresh=false terminal=false"
echo "---"
echo "PINK |color=PINK"
echo "--pink #FFC0CB (255, 192, 203) | color=#FFC0CB bash='$0' param1=copy param2='#FFC0CB' refresh=false terminal=false"
echo "--lightpink #FFB6C1 (255, 182, 193) | color=#FFB6C1 bash='$0' param1=copy param2='#FFB6C1' refresh=false terminal=false"
echo "--hotpink #FF69B4 (255, 105, 180) | color=#FF69B4 bash='$0' param1=copy param2='#FF69B4' refresh=false terminal=false"
echo "--deeppink #FF1493 (255, 20, 147) | color=#FF1493 bash='$0' param1=copy param2='#FF1493' refresh=false terminal=false"
echo "--mediumvioletred #C71585 (199, 21, 133) | color=#C71585 bash='$0' param1=copy param2='#C71585' refresh=false terminal=false"
echo "--palevioletred #DB7093 (219, 112, 147) | color=#DB7093 bash='$0' param1=copy param2='#DB7093' refresh=false terminal=false"
echo "---"
echo "ORANGE |color=ORANGE"
echo "--lightsalmon #FFA07A (255, 160, 122) | color=#FFA07A bash='$0' param1=copy param2='#FFA07A' refresh=false terminal=false"
echo "--coral #FF7F50 (255, 127, 80) | color=#FF7F50 bash='$0' param1=copy param2='#FF7F50' refresh=false terminal=false"
echo "--tomato #FF6347 (255, 99, 71) | color=#FF6347 bash='$0' param1=copy param2='#FF6347' refresh=false terminal=false"
echo "--orangered #FF4500 (255, 69, 0) | color=#FF4500 bash='$0' param1=copy param2='#FF4500' refresh=false terminal=false"
echo "--darkorange #FF8C00 (255, 140, 0) | color=#FF8C00 bash='$0' param1=copy param2='#FF8C00' refresh=false terminal=false"
echo "--orange #FFA500 (255, 165, 0) | color=#FFA500 bash='$0' param1=copy param2='#FFA500' refresh=false terminal=false"
echo "---"
echo "YELLOW |color=YELLOW"
echo "--gold #FFD700 (255, 215, 0) | color=#FFD700 bash='$0' param1=copy param2='#FFD700' refresh=false terminal=false"
echo "--yellow #FFFF00 (255, 255, 0) | color=#FFFF00 bash='$0' param1=copy param2='#FFFF00' refresh=false terminal=false"
echo "--lightyellow #FFFFE0 (255, 255, 224) | color=#FFFFE0 bash='$0' param1=copy param2='#FFFFE0' refresh=false terminal=false"
echo "--lemonchiffon #FFFACD (255, 250, 205) | color=#FFFACD bash='$0' param1=copy param2='#FFFACD' refresh=false terminal=false"
echo "--lightgoldenrodyellow #FAFAD2 (250, 250, 210) | color=#FAFAD2 bash='$0' param1=copy param2='#FAFAD2' refresh=false terminal=false"
echo "--papayawhip #FFEFD5 (255, 239, 213) | color=#FFEFD5 bash='$0' param1=copy param2='#FFEFD5' refresh=false terminal=false"
echo "--moccasin #FFE4B5 (255, 228, 181) | color=#FFE4B5 bash='$0' param1=copy param2='#FFE4B5' refresh=false terminal=false"
echo "--peachpuff #FFDAB9 (255, 218, 185) | color=#FFDAB9 bash='$0' param1=copy param2='#FFDAB9' refresh=false terminal=false"
echo "--palegoldenrod #EEE8AA (238, 232, 170) | color=#EEE8AA bash='$0' param1=copy param2='#EEE8AA' refresh=false terminal=false"
echo "--khaki #F0E68C (240, 230, 140) | color=#F0E68C bash='$0' param1=copy param2='#F0E68C' refresh=false terminal=false"
echo "--darkkhaki #BDB76B (189, 183, 107) | color=#BDB76B bash='$0' param1=copy param2='#BDB76B' refresh=false terminal=false"
echo "---"
echo "PURPLE |color=PURPLE"
echo "--lavender #E6E6FA (230, 230, 250) | color=#E6E6FA bash='$0' param1=copy param2='#E6E6FA' refresh=false terminal=false"
echo "--thistle #D8BFD8 (216, 191, 216) | color=#D8BFD8 bash='$0' param1=copy param2='#D8BFD8' refresh=false terminal=false"
echo "--plum #DDA0DD (221, 160, 221) | color=#DDA0DD bash='$0' param1=copy param2='#DDA0DD' refresh=false terminal=false"
echo "--violet #EE82EE (238, 130, 238) | color=#EE82EE bash='$0' param1=copy param2='#EE82EE' refresh=false terminal=false"
echo "--orchid #DA70D6 (218, 112, 214) | color=#DA70D6 bash='$0' param1=copy param2='#DA70D6' refresh=false terminal=false"
echo "--fuchsia #FF00FF (255, 0, 255) | color=#FF00FF bash='$0' param1=copy param2='#FF00FF' refresh=false terminal=false"
echo "--magenta #FF00FF (255, 0, 255) | color=#FF00FF bash='$0' param1=copy param2='#FF00FF' refresh=false terminal=false"
echo "--mediumorchid #BA55D3 (186, 85, 211) | color=#BA55D3 bash='$0' param1=copy param2='#BA55D3' refresh=false terminal=false"
echo "--mediumpurple #9370DB (147, 112, 219) | color=#9370DB bash='$0' param1=copy param2='#9370DB' refresh=false terminal=false"
echo "--rebeccapurple #663399 (102, 51, 153) | color=#663399 bash='$0' param1=copy param2='#663399' refresh=false terminal=false"
echo "--blueviolet #8A2BE2 (138, 43, 226) | color=#8A2BE2 bash='$0' param1=copy param2='#8A2BE2' refresh=false terminal=false"
echo "--darkviolet #9400D3 (148, 0, 211) | color=#9400D3 bash='$0' param1=copy param2='#9400D3' refresh=false terminal=false"
echo "--darkorchid #9932CC (153, 50, 204) | color=#9932CC bash='$0' param1=copy param2='#9932CC' refresh=false terminal=false"
echo "--darkmagenta #8B008B (139, 0, 139) | color=#8B008B bash='$0' param1=copy param2='#8B008B' refresh=false terminal=false"
echo "--purple #800080 (128, 0, 128) | color=#800080 bash='$0' param1=copy param2='#800080' refresh=false terminal=false"
echo "--indigo #4B0082 (75, 0, 130) | color=#4B0082 bash='$0' param1=copy param2='#4B0082' refresh=false terminal=false"
echo "--slateblue #6A5ACD (106, 90, 205) | color=#6A5ACD bash='$0' param1=copy param2='#6A5ACD' refresh=false terminal=false"
echo "--darkslateblue #483D8B (72, 61, 139) | color=#483D8B bash='$0' param1=copy param2='#483D8B' refresh=false terminal=false"
echo "--mediumslateblue #7B68EE (123, 104, 238) | color=#7B68EE bash='$0' param1=copy param2='#7B68EE' refresh=false terminal=false"
echo "---"
echo "GREEN |color=GREEN"
echo "--greenyellow #ADFF2F (173, 255, 47) | color=#ADFF2F bash='$0' param1=copy param2='#ADFF2F' refresh=false terminal=false"
echo "--chartreuse #7FFF00 (127, 255, 0) | color=#7FFF00 bash='$0' param1=copy param2='#7FFF00' refresh=false terminal=false"
echo "--lawngreen #7CFC00 (124, 252, 0) | color=#7CFC00 bash='$0' param1=copy param2='#7CFC00' refresh=false terminal=false"
echo "--lime #00FF00 (0, 255, 0) | color=#00FF00 bash='$0' param1=copy param2='#00FF00' refresh=false terminal=false"
echo "--limegreen #32CD32 (50, 205, 50) | color=#32CD32 bash='$0' param1=copy param2='#32CD32' refresh=false terminal=false"
echo "--palegreen #98FB98 (152, 251, 152) | color=#98FB98 bash='$0' param1=copy param2='#98FB98' refresh=false terminal=false"
echo "--lightgreen #90EE90 (144, 238, 144) | color=#90EE90 bash='$0' param1=copy param2='#90EE90' refresh=false terminal=false"
echo "--mediumspringgreen #00FA9A (0, 250, 154) | color=#00FA9A bash='$0' param1=copy param2='#00FA9A' refresh=false terminal=false"
echo "--springgreen #00FF7F (0, 255, 127) | color=#00FF7F bash='$0' param1=copy param2='#00FF7F' refresh=false terminal=false"
echo "--mediumseagreen #3CB371 (60, 179, 113) | color=#3CB371 bash='$0' param1=copy param2='#3CB371' refresh=false terminal=false"
echo "--seagreen #2E8B57 (46, 139, 87) | color=#2E8B57 bash='$0' param1=copy param2='#2E8B57' refresh=false terminal=false"
echo "--forestgreen #228B22 (34, 139, 34) | color=#228B22 bash='$0' param1=copy param2='#228B22' refresh=false terminal=false"
echo "--green #008000 (0, 128, 0) | color=#008000 bash='$0' param1=copy param2='#008000' refresh=false terminal=false"
echo "--darkgreen #006400 (0, 100, 0) | color=#006400 bash='$0' param1=copy param2='#006400' refresh=false terminal=false"
echo "--yellowgreen #9ACD32 (154, 205, 50) | color=#9ACD32 bash='$0' param1=copy param2='#9ACD32' refresh=false terminal=false"
echo "--olivedrab #6B8E23 (107, 142, 35) | color=#6B8E23 bash='$0' param1=copy param2='#6B8E23' refresh=false terminal=false"
echo "--olive #808000 (128, 128, 0) | color=#808000 bash='$0' param1=copy param2='#808000' refresh=false terminal=false"
echo "--darkolivegreen #556B2F (85, 107, 47) | color=#556B2F bash='$0' param1=copy param2='#556B2F' refresh=false terminal=false"
echo "--mediumaquamarine #66CDAA (102, 205, 170) | color=#66CDAA bash='$0' param1=copy param2='#66CDAA' refresh=false terminal=false"
echo "--darkseagreen #8FBC8B (143, 188, 139) | color=#8FBC8B bash='$0' param1=copy param2='#8FBC8B' refresh=false terminal=false"
echo "--lightseagreen #20B2AA (32, 178, 170) | color=#20B2AA bash='$0' param1=copy param2='#20B2AA' refresh=false terminal=false"
echo "--darkcyan #008B8B (0, 139, 139) | color=#008B8B bash='$0' param1=copy param2='#008B8B' refresh=false terminal=false"
echo "--teal #008080 (0, 128, 128) | color=#008080 bash='$0' param1=copy param2='#008080' refresh=false terminal=false"
echo "---"
echo "BLUE |color=BLUE"
echo "--aqua #00FFFF (0, 255, 255) | color=#00FFFF bash='$0' param1=copy param2='#00FFFF' refresh=false terminal=false"
echo "--cyan #00FFFF (0, 255, 255) | color=#00FFFF bash='$0' param1=copy param2='#00FFFF' refresh=false terminal=false"
echo "--lightcyan #E0FFFF (224, 255, 255) | color=#E0FFFF bash='$0' param1=copy param2='#E0FFFF' refresh=false terminal=false"
echo "--paleturquoise #AFEEEE (175, 238, 238) | color=#AFEEEE bash='$0' param1=copy param2='#AFEEEE' refresh=false terminal=false"
echo "--aquamarine #7FFFD4 (127, 255, 212) | color=#7FFFD4 bash='$0' param1=copy param2='#7FFFD4' refresh=false terminal=false"
echo "--turquoise #40E0D0 (64, 224, 208) | color=#40E0D0 bash='$0' param1=copy param2='#40E0D0' refresh=false terminal=false"
echo "--mediumturquoise #48D1CC (72, 209, 204) | color=#48D1CC bash='$0' param1=copy param2='#48D1CC' refresh=false terminal=false"
echo "--darkturquoise #00CED1 (0, 206, 209) | color=#00CED1 bash='$0' param1=copy param2='#00CED1' refresh=false terminal=false"
echo "--cadetblue #5F9EA0 (95, 158, 160) | color=#5F9EA0 bash='$0' param1=copy param2='#5F9EA0' refresh=false terminal=false"
echo "--steelblue #4682B4 (70, 130, 180) | color=#4682B4 bash='$0' param1=copy param2='#4682B4' refresh=false terminal=false"
echo "--lightsteelblue #B0C4DE (176, 196, 222) | color=#B0C4DE bash='$0' param1=copy param2='#B0C4DE' refresh=false terminal=false"
echo "--powderblue #B0E0E6 (176, 224, 230) | color=#B0E0E6 bash='$0' param1=copy param2='#B0E0E6' refresh=false terminal=false"
echo "--lightblue #ADD8E6 (173, 216, 230) | color=#ADD8E6 bash='$0' param1=copy param2='#ADD8E6' refresh=false terminal=false"
echo "--skyblue #87CEEB (135, 206, 235) | color=#87CEEB bash='$0' param1=copy param2='#87CEEB' refresh=false terminal=false"
echo "--lightskyblue #87CEFA (135, 206, 250) | color=#87CEFA bash='$0' param1=copy param2='#87CEFA' refresh=false terminal=false"
echo "--deepskyblue #00BFFF (0, 191, 255) | color=#00BFFF bash='$0' param1=copy param2='#00BFFF' refresh=false terminal=false"
echo "--dodgerblue #1E90FF (30, 144, 255) | color=#1E90FF bash='$0' param1=copy param2='#1E90FF' refresh=false terminal=false"
echo "--cornflowerblue #6495ED (100, 149, 237) | color=#6495ED bash='$0' param1=copy param2='#6495ED' refresh=false terminal=false"
echo "--mediumslateblue #7B68EE (123, 104, 238) | color=#7B68EE bash='$0' param1=copy param2='#7B68EE' refresh=false terminal=false"
echo "--royalblue #4169E1 (65, 105, 225) | color=#4169E1 bash='$0' param1=copy param2='#4169E1' refresh=false terminal=false"
echo "--blue #0000FF (0, 0, 255) | color=#0000FF bash='$0' param1=copy param2='#0000FF' refresh=false terminal=false"
echo "--mediumblue #0000CD (0, 0, 205) | color=#0000CD bash='$0' param1=copy param2='#0000CD' refresh=false terminal=false"
echo "--darkblue #00008B (0, 0, 139) | color=#00008B bash='$0' param1=copy param2='#00008B' refresh=false terminal=false"
echo "--navy #000080 (0, 0, 128) | color=#000080 bash='$0' param1=copy param2='#000080' refresh=false terminal=false"
echo "--midnightblue #191970 (25, 25, 112) | color=#191970 bash='$0' param1=copy param2='#191970' refresh=false terminal=false"
echo "---"
echo "BROWN |color=BROWN"
echo "--cornsilk #FFF8DC (255, 248, 220) | color=#FFF8DC bash='$0' param1=copy param2='#FFF8DC' refresh=false terminal=false"
echo "--blanchedalmond #FFEBCD (255, 235, 205) | color=#FFEBCD bash='$0' param1=copy param2='#FFEBCD' refresh=false terminal=false"
echo "--bisque #FFE4C4 (255, 228, 196) | color=#FFE4C4 bash='$0' param1=copy param2='#FFE4C4' refresh=false terminal=false"
echo "--navajowhite #FFDEAD (255, 222, 173) | color=#FFDEAD bash='$0' param1=copy param2='#FFDEAD' refresh=false terminal=false"
echo "--wheat #F5DEB3 (245, 222, 179) | color=#F5DEB3 bash='$0' param1=copy param2='#F5DEB3' refresh=false terminal=false"
echo "--burlywood #DEB887 (222, 184, 135) | color=#DEB887 bash='$0' param1=copy param2='#DEB887' refresh=false terminal=false"
echo "--tan #D2B48C (210, 180, 140) | color=#D2B48C bash='$0' param1=copy param2='#D2B48C' refresh=false terminal=false"
echo "--rosybrown #BC8F8F (188, 143, 143) | color=#BC8F8F bash='$0' param1=copy param2='#BC8F8F' refresh=false terminal=false"
echo "--sandybrown #F4A460 (244, 164, 96) | color=#F4A460 bash='$0' param1=copy param2='#F4A460' refresh=false terminal=false"
echo "--goldenrod #DAA520 (218, 165, 32) | color=#DAA520 bash='$0' param1=copy param2='#DAA520' refresh=false terminal=false"
echo "--darkgoldenrod #B8860B (184, 134, 11) | color=#B8860B bash='$0' param1=copy param2='#B8860B' refresh=false terminal=false"
echo "--peru #CD853F (205, 133, 63) | color=#CD853F bash='$0' param1=copy param2='#CD853F' refresh=false terminal=false"
echo "--chocolate #D2691E (210, 105, 30) | color=#D2691E bash='$0' param1=copy param2='#D2691E' refresh=false terminal=false"
echo "--saddlebrown #8B4513 (139, 69, 19) | color=#8B4513 bash='$0' param1=copy param2='#8B4513' refresh=false terminal=false"
echo "--sienna #A0522D (160, 82, 45) | color=#A0522D bash='$0' param1=copy param2='#A0522D' refresh=false terminal=false"
echo "--brown #A52A2A (165, 42, 42) | color=#A52A2A bash='$0' param1=copy param2='#A52A2A' refresh=false terminal=false"
echo "--maroon #800000 (128, 0, 0) | color=#800000 bash='$0' param1=copy param2='#800000' refresh=false terminal=false"
echo "---"
echo "WHITE |color=WHITE"
echo "--white #FFFFFF (255, 255, 255) | color=#FFFFFF bash='$0' param1=copy param2='#FFFFFF' refresh=false terminal=false"
echo "--snow #FFFAFA (255, 250, 250) | color=#FFFAFA bash='$0' param1=copy param2='#FFFAFA' refresh=false terminal=false"
echo "--honeydew #F0FFF0 (240, 255, 240) | color=#F0FFF0 bash='$0' param1=copy param2='#F0FFF0' refresh=false terminal=false"
echo "--mintcream #F5FFFA (245, 255, 250) | color=#F5FFFA bash='$0' param1=copy param2='#F5FFFA' refresh=false terminal=false"
echo "--azure #F0FFFF (240, 255, 255) | color=#F0FFFF bash='$0' param1=copy param2='#F0FFFF' refresh=false terminal=false"
echo "--aliceblue #F0F8FF (240, 248, 255) | color=#F0F8FF bash='$0' param1=copy param2='#F0F8FF' refresh=false terminal=false"
echo "--ghostwhite #F8F8FF (248, 248, 255) | color=#F8F8FF bash='$0' param1=copy param2='#F8F8FF' refresh=false terminal=false"
echo "--whitesmoke #F5F5F5 (245, 245, 245) | color=#F5F5F5 bash='$0' param1=copy param2='#F5F5F5' refresh=false terminal=false"
echo "--seashell #FFF5EE (255, 245, 238) | color=#FFF5EE bash='$0' param1=copy param2='#FFF5EE' refresh=false terminal=false"
echo "--beige #F5F5DC (245, 245, 220) | color=#F5F5DC bash='$0' param1=copy param2='#F5F5DC' refresh=false terminal=false"
echo "--oldlace #FDF5E6 (253, 245, 230) | color=#FDF5E6 bash='$0' param1=copy param2='#FDF5E6' refresh=false terminal=false"
echo "--floralwhite #FFFAF0 (255, 250, 240) | color=#FFFAF0 bash='$0' param1=copy param2='#FFFAF0' refresh=false terminal=false"
echo "--ivory #FFFFF0 (255, 255, 240) | color=#FFFFF0 bash='$0' param1=copy param2='#FFFFF0' refresh=false terminal=false"
echo "--antiquewhite #FAEBD7 (250, 235, 215) | color=#FAEBD7 bash='$0' param1=copy param2='#FAEBD7' refresh=false terminal=false"
echo "--linen #FAF0E6 (250, 240, 230) | color=#FAF0E6 bash='$0' param1=copy param2='#FAF0E6' refresh=false terminal=false"
echo "--lavenderblush #FFF0F5 (255, 240, 245) | color=#FFF0F5 bash='$0' param1=copy param2='#FFF0F5' refresh=false terminal=false"
echo "--mistyrose #FFE4E1 (255, 228, 225) | color=#FFE4E1 bash='$0' param1=copy param2='#FFE4E1' refresh=false terminal=false"
echo "---"
echo "GRAY |color=GRAY"
echo "--gainsboro #DCDCDC (220, 220, 220) | color=#DCDCDC bash='$0' param1=copy param2='#DCDCDC' refresh=false terminal=false"
echo "--lightgray #D3D3D3 (211, 211, 211) | color=#D3D3D3 bash='$0' param1=copy param2='#D3D3D3' refresh=false terminal=false"
echo "--silver #C0C0C0 (192, 192, 192) | color=#C0C0C0 bash='$0' param1=copy param2='#C0C0C0' refresh=false terminal=false"
echo "--darkgray #A9A9A9 (169, 169, 169) | color=#A9A9A9 bash='$0' param1=copy param2='#A9A9A9' refresh=false terminal=false"
echo "--gray #808080 (128, 128, 128) | color=#808080 bash='$0' param1=copy param2='#808080' refresh=false terminal=false"
echo "--dimgray #696969 (105, 105, 105) | color=#696969 bash='$0' param1=copy param2='#696969' refresh=false terminal=false"
echo "--lightslategray #778899 (119, 136, 153) | color=#778899 bash='$0' param1=copy param2='#778899' refresh=false terminal=false"
echo "--slategray #708090 (112, 128, 144) | color=#708090 bash='$0' param1=copy param2='#708090' refresh=false terminal=false"
echo "--darkslategray #2F4F4F (47, 79, 79) | color=#2F4F4F bash='$0' param1=copy param2='#2F4F4F' refresh=false terminal=false"
echo "--black #000000 (0, 0, 0) | color=#000000 bash='$0' param1=copy param2='#000000' refresh=false terminal=false"

