Skip to content

Instantly share code, notes, and snippets.

@julioflima
Last active January 30, 2025 12:04
Show Gist options
  • Save julioflima/38afe96edc77cfdcfad31cf61dfbd5a4 to your computer and use it in GitHub Desktop.
Save julioflima/38afe96edc77cfdcfad31cf61dfbd5a4 to your computer and use it in GitHub Desktop.
Get all HEX colors from text and remove repeated.
// select all the lines that doesn't have an color in #hex
// #(?:[0-9a-fA-F]{3}){1,2}\b
// select all the lines that doesn't have an color in #hex
// replace it for something unique: "lalalallalalallalalalallalalla"
// select all CMD + D, then remove lines
// ^(?!.*#(?:[0-9a-fA-F]{3}){1,2}\b).*
const text = `45: @function photoshop-shadow($angle: 0, $distance: 0, $spread: 0, $size: 0, $color: #000, $inner: false) {
56: @function photoshop-text-shadow($angle: 0, $distance: 0, $spread: 0, $size: 0, $color: #000) {
14: $color_white: #FFF;
15: $color_black: #000;
16: $color_red: #A32415;
18: $color_blue: #274050;
19: $color_blue_text: #4471A7;
20: $color_light_blue: #f5f7fa;
21: $color_gray_blue: #A9B7C2;
23: $color_dark_grey_border: #C7C7C7;
24: $color_light_grey_border: #E5E5E5;
26: $color_grey: #AAAAAA;
27: $color_stronger_grey: #777777;
28: $color_strong_grey: #6D6D6E;
29: $color_lighter_grey: #F3F3F3;
30: $color_light_grey: #CCCCCC;
31: $color_dark_grey: #555555;
33: $color_green: #5D9346;
34: $color_green_text: #487837;
35: $color_light_green: #05800e;
37: $color_orange_text: #DB691D;
38: $color_red_error: #882419;
41: $color_training: #4A72AA;
47: $color_grey_bar: #e6e6e6;
49: $color_btn_green: #728f4c;
3: $background-light-blue: #EBF4F6;
4: $background-bright-blue: #D9E8FA;
5: $background-blue: #3d566e;
6: $background-dark-blue: #3b5160;
7: $metal-blue: #768A99;
8: $background-yellow: #FFF361;
9: $background-red: #FFECEA;
10: $background-white-blue: #ECF0F1;
12: $background-orange: #fff1e1;
13: $orange: #f39c12;
14: $dark-orange: #DE7402;
15: $purple: #C793E5;
17: $black: #111;
19: $dulled-copy: #a9b7c2;
20: $gray-copy: #7D868C;
21: $copy:#3C5361;
22: $dark-copy:#274050;
23: $dark-gray-copy:#222;
25: $medium-gray-light: #5e5e5e;
26: $medium-gray: #4b4b4b;
27: $gray: #666;
28: $light-gray: #999;
29: $lighter-gray: #ccc;
30: $lightest-gray: #eee;
32: $red: #E74C3C;
33: $light-red: #e74c3c;
35: $progress-green: #32A49A;
36: $green: #27AE60;
37: $light-green: #2ecc71;
38: $olive-green: #84ae27;
39: $blue: #4A90E2;
40: $bright-blue: #54A4FF;
42: $line-gray: #e6ebed;
43: $line-dark-gray: #D8D8D8;
44: $dark-gray: #222;
45: $icon-gray: #a9b7c2;
15: background: #fff;
36: color: #274050;
53: border: 1px solid #f0f0f0;
55: background: #f7f7f9;
58: color: #274050;
15: background: #fff;
26: color: #fff;
38: color: #fff;
47: color: lighten(#4F6F8F, 30%);
56: background: #34495E;
64: background: #ECF0F1;
13: border-bottom: 1px solid #fff;
384: // box-shadow: 0 0 4px rgba(#000, .2);
392: box-shadow: 0 0 4px rgba(#000, .2);
7: background: #34495E;
13: color: #fff;
20: > header { background: #ECF0F1; }
26: &#sticky-footer-wrapper { background: #34495E; }
31: color: #fff;
37: color: #fff;
42: background: #fff;
59: background: #fff;
66: background: #fff;
79: background: #34495E;
83: color: #fff;
90: background: #3d566e;
239: border: rem(1px) solid #ECF0F1;
24: color: #fff;
41: background: #27ae60;
49: background: #e74c3c;
58: color: #fff;
7: background: #ECF0F1;
17: color: #274050;
48: color: #fff;
58: background: darken(#ECF0F1, 2%);
70: background: darken(#ECF0F1, 2%);
71: border: 4px solid #f4d455;
97: background: darken(#ECF0F1, 10%);
110: color: #3D566E;
128: color: #A9B7C2;
143: color: #A9B7C2;
207: background: #fff;
215: background: #fff;
4: $btn-auth-facebook-color: #3B5998;
5: $btn-auth-google_oath2-color: #245DC1;
6: $btn-auth-linkedin-color: #007FB1;
7: $btn-auth-github-color: #4183C4;
16: background: #274050;
17: background: rgba(#274050, .9);
18: color: #fff;
28: color: #fff;
29: background: linear-gradient(lighten(rgba(#274050, .9), 10%), rgba(#274050, .9));
30: box-shadow: inset 0 0 rem(1px) rem(1px) rgba(#000, .2), rem(1px) rem(1px) rem(2px) 0 rgba(#000, .2);
37: background: #d2d2d2 !important;
75: background: #27ae60;
93: background: #e74c3c;
110: background: #27ae60;
114: background: #e67e22;
120: background: lighten(#3D566E, 5%);
121: border-bottom: 4px solid rgba(#274050, .9);
128: color: #fff;
170: background: #3D566E;
260: ⟪ 7242 characters skipped ⟫rB0oQLiCxjhsTiqVCgBokg2AFaNWUADmgA9ICgBAUdHozyJArQ7xNCfgxnuHAim49PHKQZ6FBkiCGBChCR+j5NgkAN15yZ4pBMjQYFQSCC0AlmTKUQAc184kEG/WEAwg5AjBXTBE0co80JDKqBwQlOQFJIBRN6Eo1AGTyhoUBICABiTBzApAE1zzQUU0xKKDFjQAA7) #d2d2d2 no-repeat 15px center !important;
309: background: linear-gradient(white,#e1e1e1);
310: box-shadow: inset 0 0 0px 1px #cecece;
314: background: linear-gradient(white,#f2f2f2);
8: color: #34495E;
9: background: #fff;
17: color: lighten(#34495E, 5%);
34: border-left: 2px solid #ECF0F1;
41: color: darken(#ECF0F1, 50%);
49: color: lighten(#34495E, 10%);
98: color: #fff;
15: background: #3D566E;
26: color: #fff;
8: background: #27282A;
25: color: #ECF0F1;
35: border-top-color: #34495E;
36: color: lighten(#3D566E, 20%);
43: color: #ECF0F1;
4: $error-color: #E74C3C;
26: border-color: #274050;
27: border-color: rgba(#274050, .5);
29: color: #274050;
33: border-color: lighten(#34495E, 10%);
55: color: lighten(#4D5E6C, 35%);
92: color: #fff;
125: background: #fff;
131: border-color: lighten(#274050, 10%);
132: border-color: rgba(lighten(#274050, 10%), .5);
152: color: #274050;
176: border-color: rgba(#274050, .9) transparent transparent;
186: border-right: 3px solid #fff;
189: background: #ECF0F1;
190: color: #274050;
199: background: linear-gradient(rgba(#f3f3f3, .9), darken(rgba(#f3f3f3, .9), 5%));
221: border-color: #a9b7c2;
231: border-color: #f3f3f3;
153: border-bottom: 1px solid #fff;
16: border: 1px solid #E4E4E4;
31: background: #fafafa;
36: background: #D3E7FF;
115: background: #F2FDFF;
27: background: lighten(#ECF0F1, 3%);
74: background: #ECF0F1;
80: border-right: rem(2px) solid darken(#ECF0F1, 2%);
89: color: #A9B7C2;
121: color: #2ecc71;
140: color: #f1c40f;
151: color: #e74c3c;
161: color: #f39c12;
258: color: rgba(#4f6f8f, .1);
274: color: lighten(#4f6f8f, 10%);
279: color: rgba(#4f6f8f, 1);
7: background: #32a49a;
14: background: #D1D4D9;
31: border: 1px solid #aaa;
8: border: 1px solid #cbd8e2;
90: border: 1px solid #ccc;
108: box-shadow: inset 0 0 rem(1px) rem(1px) rgba(#000, .2), rem(1px) rem(1px) rem(2px) 0 rgba(#000, .2);
13: background: #ECF0F1;
21: background: #a9b7c2;
28: color: #3B5160;
9: color: #999;
4: $sidebar-bg-color: #3B5160;
8: $is-done-color: lighten(#728f4c, 5%);
35: border-bottom: rem(2px) solid #fff;
44: color: #fff;
100: border-color: rgba(#fff, 0);
101: border-top-color: #fff;
113: color: #fff;
2: color: #27ae60;
6: color: #f39c12;
10: color: darken(#A9B7C2, 10%);
14: color: #e67e22;
155: color: #ccc;
192: border: 1px solid #ccc;
283: color: #ccc;
291: .style_guide__term_list__author { color: #ccc; }
17: background: #3D566E;
18: color: #fff;
45: background: #ECF0F1;
16: background: #ECF0F1;
17: color: #A9B7C2;
23: background: lighten(#CFD9DB, 5%);
24: color: darken(#A9B7C2, 15%);
29: background: #CFD9DB;
30: color: darken(#A9B7C2, 30%);
55: background: lighten(#CFD9DB, 5%);
58: background: lighten(#CFD9DB, 7%);
62: background: #fff;
24: border-color: #999;
162: border-color: #999;
208: background: #27AE60;
256: color: #27AE60;
323: color: #fff;
324: background: linear-gradient(lighten(rgba(#274050, .9), 10%), rgba(#274050, .9));
325: box-shadow: inset 0 0 rem(1px) rem(1px) rgba(#000, .2), rem(1px) rem(1px) rem(2px) 0 rgba(#000, .2);
16: color: #fff;
37: border-bottom: 4px solid lighten(#34495E, 5%);
60: img { border-color: lighten(#34495E, 5%); }
94: box-shadow: rem(-1px) rem(1px) rem(1px) 0 rgba(#000, .1);
23: color: #fff;
25: box-shadow: inset 0 0 rem(1px) rem(1px) rgba(#000, .2), rem(1px) rem(1px) rem(2px) 0 rgba(#000, .2);
84: background: #F6FFFA
88: background: #c7ffe0
105: background: #E7F2FF
109: background: #cee4ff
207: background: #8A8A8A;
236: border-top-color: #8A8A8A;
10: border: 1px solid #8CA5AB;
43: border-bottom-color: #8CA5AB;
330: color: #333;
1: $h_main: #dbecff;
2: $spelling_color: #8A97A6;
3: $grammar_color: #C58EF4;
4: $bad_color: #E28888;
13: $fake-border-background-hover: linear-gradient(to top, transparent, transparent 3px, #DBF6FF 3px, #DBF6FF);
15: border-right: 2px solid #D8D8D8;
225: background: #FFF792;
229: background: #FADE00;
272: color: #8c5600;
131: border-left: 1px solid #ecebeb;
211: border: 1px solid #8b8b8b;
249: border-bottom-color: #8b8b8b;
307: background: #e5f3fb;
35: border-top: 2px solid #bbb;
13: color: #6c6c6c;
19: border: 1px solid #aaa;
68: color: #778e9c;
121: background: linear-gradient(lighten(rgba(#efefef, .9), 10%), rgba(#efefef, .9));
161: color: #767676;
181: color: #292929;
122: .quality_type__ball--purple { background-color: #B22ECC; }
125: .quality_type__ball--light-blue { background-color: #7DE0E3; }
142: background-color: #dbecff;
147: background-color: #dbecff;
370: background: #F2F2F2;
408: background: #F2F2F2;
409: border: 1px solid #E1E1E1;
16: color: #333;
2: arrowColor: "#a2acb3",
2: spelling: "#E74C3C",
3: grammar: "#f39c12",
4: bad: "#2ecc71",
5: punctuation: "#B22ECC",
6: terminology: "#4A90E2",
7: fluency: "#7DE0E3",
8: accuracy: "#27AE60",
118: spellingHuman: "#E74C3C",
119: punctuation: "#B22ECC",
120: grammar: "#f39c12",
121: terminology: "#4A90E2",
122: fluency: "#7DE0E3",
123: accuracy: "#27AE60",
124: wrong: "#2ecc71",
4: border: 1px solid #e6ebed;
22: background-color: #3D8AE9;
37: color: #5E5E5E;
48: color: #BDC9D4;
109: spellingHuman: "#E74C3C",
110: punctuation: "#B22ECC",
111: grammar: "#f39c12",
112: terminology: "#4A90E2",
113: fluency: "#7DE0E3",
114: accuracy: "#27AE60",
115: wrong: "#2ecc71",
22: <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#343739">
25: <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#343739">
29: <table width="100%" align="center" border="0" cellspacing="0" cellpadding="0" bgcolor="#ECF0F1">
36: <td height="114" align="left" valign="middle" width="630" bgcolor="#ECF0F1">
48: <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#34495E">
58: <td width="590" valign="top" align="left" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-weight: 300; text-align:left; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; color: #ffffff;">
59: <h1 style="margin: 20px 0 0 0; padding: 0; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 38px; line-height: 38px; font-weight: 300; text-align:left; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; color: #ffffff;" ><%= I18n.t("devise.mailer.confirmation_instructions.welcome", email: user.name) %></h1>
62: <span style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 22px; line-height: 35px; font-weight: 300; text-align:left; vertical-align:top; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; color: #ffffff;"><%= I18n.t("devise.mailer.confirmation_instructions.confirm_instructions") %></span></p>
76: <td width="202" height="72" bgcolor="#2ecc71" align="center" style="font-size: 24px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-weight: 300; border-bottom: 4px solid #10ae53; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; line-height: 24px;">
77: <a href="<%= Tolq::Config.translators_url %>/confirmation?confirmation_token=<%= token %>" class="btn" style="padding: 24px 40px; color: #ffffff; text-decoration: none;"><font face="Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif" size="5"><%= I18n.t("devise.mailer.confirmation_instructions.confirm").html_safe %></font></a>
95: <table width="100%" align="center" border="0" cellspacing="0" cellpadding="0" bgcolor="#ECF0F1">
105: <p style="margin: 0 0 40px 0; padding: 0; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 18px; text-align: left; font-weight: 300; color: #3d566e;">
106: <a style="color: #6f88a0;" href="http://tolq.com">Tolq</a>
108: <a style="color: #6f88a0;" href="https://www.facebook.com/tolqcom">Facebook</a>
110: <a style="color: #6f88a0;" href="https://twitter.com/tolqcom">Twitter</a>
113: <p class="footer" style="margin: 0 0 20px 0; padding: 0; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; text-align: left; font-weight: 300; color: #a9b7c2; line-height: 22px;">
22: <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#343739">
25: <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#343739">
29: <table width="100%" align="center" border="0" cellspacing="0" cellpadding="0" bgcolor="#ECF0F1">
36: <td height="114" align="left" valign="middle" width="630" bgcolor="#ECF0F1">
48: <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#34495E">
58: <td width="590" valign="top" align="left" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-weight: 300; text-align:left; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; color: #ffffff;">
59: <h1 style="margin: 20px 0 0 0; padding: 0; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 38px; line-height: 38px; font-weight: 300; text-align:left; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; color: #ffffff;" ><%= I18n.t("devise.mailer.reset_password_instructions.hello", email: user.email) %></h1>
62: <span style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 22px; line-height: 35px; font-weight: 300; text-align:left; vertical-align:top; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; color: #ffffff;"><%= I18n.t("devise.mailer.reset_password_instructions.explanation1") %><br><%= I18n.t("devise.mailer.reset_password_instructions.explanation2") %><br><%= I18n.t("devise.mailer.reset_password_instructions.explanation3") %></span></p>
76: <td width="202" height="72" bgcolor="#2ecc71" align="center" style="font-size: 24px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-weight: 300; border-bottom: 4px solid #10ae53; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; line-height: 24px;">
77: <a class="btn" style="padding: 24px 40px; color: #ffffff; text-decoration: none;" href="<%= Tolq::Config.translators_url %>/password/edit?reset_password_token=<%= token %>"><font face="Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif" size="5"><%= I18n.t("devise.mailer.reset_password_instructions.change_pwd").html_safe %></font></a>
95: <table width="100%" align="center" border="0" cellspacing="0" cellpadding="0" bgcolor="#ECF0F1">
105: <p style="margin: 0 0 40px 0; padding: 0; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 18px; text-align: left; font-weight: 300; color: #3d566e;">
106: <a style="color: #6f88a0;" href="#">Tolq</a>
108: <a style="color: #6f88a0;" href="#">Facebook</a>
110: <a style="color: #6f88a0;" href="#">Twitter</a>
113: <p class="footer" style="margin: 0 0 20px 0; padding: 0; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; text-align: left; font-weight: 300; color: #a9b7c2; line-height: 22px;">
116: We sent this e-mail to you because you've signed up for updated. If you don't want to receive future updates anymore you can <a style="color: #6f88a0;" href="#">unsubscribe</a>.
16: p class="icon-before" data-icon=="&#128274;"
19: p.icon-before data-icon=="&#128179;"
1: *{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}html,body{font-size:16px;text-rendering:optimizelegibility;margin:0;padding:0;font-family:"Lato", "Helvetica Neue", "Helvetica";background:#fff}b{font-weight:normal}h1,h2{margin:0;padding:0 0 1.875rem;color:#fff;color:rgba(255,255,255,0.9);font:200 2.375rem "Lato", "Helvetica Neue", "Helvetica"}h2{padding:0 0 1.875rem;font-size:2.375rem}p{margin:0 0 2.5rem;font:300 1.25rem "Lato";color:#fff;color:rgba(255,255,255,0.9);line-height:1.4}p:last-child{margin-bottom:0}a{color:#a8bbcf;text-decoration:none}a:hover{text-decoration:underline}#container{background:#34495E;text-align:center}.l-error>header{position:relative;padding:2.5rem;background:#ECF0F1}.l-error>header>nav{position:absolute;top:2.5rem;right:2.5rem}.l-error main{display:inline-block;padding:3.75rem 2.5rem 2.5rem;min-height:500px;text-align:left;padding-left:21rem}.l-error-404 main{background:url(/images/binoculars.png) no-repeat left 6.25rem;background-size:16rem}.l-error-500 main{background:url(/images/bomb.png) no-repeat left 3.75rem;background-size:16rem}
6522: // Process html entity - &#123;, &#xAF;, &quot;, ...
7653: htmlCharacterEntitiesRegex: /(&nbsp;|&#160;|&lt;|&#60;|&gt;|&#62;)/gi,
4: ⟪ 16638 characters skipped ⟫il.assign(this,t),this.matchValidator=new e.MatchValidator};return e.prototype={constructor:e,urls:!0,email:!0,twitter:!0,newWindow:!0,stripPrefix:!0,className:"",htmlCharacterEntitiesRegex:/(&nbsp;|&#160;|&lt;|&#60;|&gt;|&#62;)/gi,matcherRegex:function(){var e=/(^|[^\w])@(\w{1,15})/,t=/(?:[\-;:&=\+\$,\w\.]+@)/,r=/(?:[A-Za-z][-.+A-Za-z0-9]+:(?![A-Za-z][-.+A-Za-z0-9]+:\/\/)(?!\d+\/?)(?:\/\/)?)/,n=/(?:www\.)/,s=/[A-Za-z0-9\.\-]*[A-Za-z0-9\-]/,o=/\.(?:international|construction|contractors|enterprises|photography|productions|foundation|immobilien|industries|management|properties|technology|christmas|community|directory|education|equipment|institute|marketing|solutions|vacations|bargains|boutique|builders|catering|cleaning|clothing|computer|democrat|diamonds|graphics|holdings|lighting|partners|plumbing|supplies|training|ventures|academy|careers|company|cruises|domains|exposed|flights|florist|gallery|guitars|holiday|kitchen|neustar|okinawa|recipes|rentals|reviews|shiksha|singles|support|systems|agency|berlin|camera|center|coffee|condos|dating|estate|events|expert|futbol|kaufen|luxury|maison|monash|museum|nagoya|photos|repair|report|social|supply|tattoo|tienda|travel|viajes|villas|vision
1364: span.style.backgroundColor = '#aaa';`;
const parser = [
["#ECF0F1", " #E7F0F7"],
["#FFF", "#FFFFFF"],
["#27AE60", "#51C394"],
["#E74C3C", "#F65050"],
["#274050", "#2D4E6D"],
["#F4D455", "#FFB800"],
["#3D566E", "#6A89A6"],
["#A9B7C2", "#B2C9DE"],
["#3B5998", "#3B7CC9"],
["#245DC1", "#1D5BA4"],
["#007FB1", "#3B7CC9"],
["#4183C4", "#68ADFF"],
["#000", "#2D363B"],
["#D2D2D2", "#D6E5F2"],
["#E67E22", "#D94747"],
["#E1E1E1", "#E7F0F7"],
["#CECECE", "#D6E5F2"],
["#F2F2F2", "#F5F8FC"],
["#34495E", "#2D4E6D"],
["#27282A", "#2D4E6D"],
["#4D5E6C", "#6A89A6"],
["#F3F3F3", "#F5F8FC"],
["#E4E4E4", "#E7F0F7"],
["#FAFAFA", "#F5F8FC"],
["#D3E7FF", "#CFEAFF"],
["#F2FDFF", "#F7FBFD"],
["#2ECC71", "#2B9D7B"],
["#F1C40F", "#FFB800"],
["#F39C12", "#E89B06"],
["#4F6F8F", "#87AACA"],
["#32A49A", "#329FAE"],
["#D1D4D9", "#D6E5F2"],
["#AAA", "#B2C9DE"],
["#CBD8E2", "#B2C9DE"],
["#CCC", "#D6E5F2"],
["#3B5160", "#6A89A6"],
["#999", "#B2C9DE"],
["#728F4C", "#51C394"],
["#CFD9DB", "#D6E5F2"],
["#F6FFFA", "#E2FFEA"],
["#C7FFE0", "#A9FFDC"],
["#E7F2FF", "#E3F3FF"],
["#CEE4FF", "#CFEAFF"],
["#8A8A8A", "#B2C9DE"],
["#8CA5AB", "#6A89A6"],
["#333", "#2D4E6D"],
["#DBECFF", "#E3F3FF"],
["#8A97A6", "#6A89A6"],
["#C58EF4", "#3B7CC9"],
["#E28888", "#F65050"],
["#DBF6FF", "#E3F3FF"],
["#D8D8D8", "#D6E5F2"],
["#FFF792", "#FFB800"],
["#FADE00", "#FFB800"],
["#8C5600", "#E89B06"],
["#ECEBEB", "#E7F0F7"],
["#8B8B8B", "#B2C9DE"],
["#E5F3FB", "#E7F0F7"],
["#BBB", "#D6E5F2"],
["#6C6C6C", "#6A89A6"],
["#778E9C", "#6A89A6"],
["#EFEFEF", "#E7F0F7"],
["#767676", "#6A89A6"],
["#292929", "#2D4E6D"],
["#B22ECC", "#1D5BA4"],
["#7DE0E3", "#329FAE"],
];
const matches = text.match(/#(?:[0-9a-fA-F]{3}){1,2}\b/g);
if (matches) {
const notUniqueColors = [...new Set([...matches].map((color) => color))];
const uniqueColors = [
...new Set([...matches].map((color) => color.toUpperCase())),
];
const uniqueColorsParser = notUniqueColors.map((color) => {
const colorIndex = parser.findIndex((item) =>
item.includes(color.toLocaleUpperCase())
);
if (colorIndex >= 0) {
return [color, parser[colorIndex][1]];
}
return [color, ""];
});
console.log(
"Copied to clipboard not unique colors:",
notUniqueColors?.length,
JSON.stringify(notUniqueColors)
);
console.log(
"Copied to clipboard unique colors: ",
uniqueColors?.length,
JSON.stringify(uniqueColors)
);
console.log(
"Copied to clipboard unique colors parser: ",
uniqueColorsParser?.length,
JSON.stringify(uniqueColorsParser)
);
} else console.log("No hex colors found.");
const newColor = [
["#000", "#2D363B"],
["#FFF", "#FFFFFF"],
["#A32415", "#F65050"],
["#274050", "#2D4E6D"],
["#4471A7", "#3B7CC9"],
["#F5F7FA", "#F5F8FC"],
["#A9B7C2", "#B2C9DE"],
["#C7C7C7", "#D6E5F2"],
["#E5E5E5", "#E7F0F7"],
["#AAAAAA", "#B2C9DE"],
["#777777", "#6A89A6"],
["#6D6D6E", "#6A89A6"],
["#F3F3F3", "#F5F8FC"],
["#CCCCCC", "#D6E5F2"],
["#555555", "#2D4E6D"],
["#5D9346", "#2B9D7B"],
["#487837", "#51C394"],
["#05800E", "#A9FFDC"],
["#DB691D", "#E89B06"],
["#882419", "#D94747"],
["#4A72AA", "#3B7CC9"],
["#E6E6E6", "#E7F0F7"],
["#728F4C", "#2B9D7B"],
["#EBF4F6", "#F7FBFD"],
["#D9E8FA", "#E3F3FF"],
["#3D566E", "#6A89A6"],
["#3B5160", "#6A89A6"],
["#768A99", "#87AACA"],
["#FFF361", "#FFB800"],
["#FFECEA", "#F5F8FC"],
["#ECF0F1", "#E7F0F7"],
["#FFF1E1", "#F5F8FC"],
["#F39C12", "#FFB800"],
["#DE7402", "#E89B06"],
["#C793E5", "#B2C9DE"],
["#111", "#2D4E6D"],
["#A9B7C2", "#B2C9DE"],
["#7D868C", "#87AACA"],
["#3C5361", "#6A89A6"],
["#222", "#2D4E6D"],
["#5E5E5E", "#6A89A6"],
["#4B4B4B", "#2D4E6D"],
["#666", "#6A89A6"],
["#999", "#B2C9DE"],
["#ccc", "#D6E5F2"],
["#eee", "#E7F0F7"],
["#E74C3C", "#F65050"],
["#E74C3C", "#F65050"],
["#32A49A", "#329FAE"],
["#27AE60", "#51C394"],
["#2ECC71", "#2B9D7B"],
["#84AE27", "#A9FFDC"],
["#4A90E2", "#3B7CC9"],
["#54A4FF", "#36ABFF"],
["#E6EBED", "#E7F0F7"],
["#D8D8D8", "#D6E5F2"],
["#fff", "#FFFFFF"],
["#F0F0F0", "#F5F8FC"],
["#F7F7F9", "#F5F8FC"],
["#4F6F8F", "#87AACA"],
["#34495E", "#2D4E6D"],
["#27AE60", "#51C394"],
["#F4D455", "#FFB800"],
["#3D566E", "#6A89A6"],
["#3B5998", "#3B7CC9"],
["#245DC1", "#1D5BA4"],
["#007FB1", "#3BBCDC"],
["#4183C4", "#68ADFF"],
["#D2D2D2", "#D6E5F2"],
["#E67E22", "#D94747"],
["#E1E1E1", "#E7F0F7"],
["#CECECE", "#D6E5F2"],
["#F2F2F2", "#F5F8FC"],
["#27282A", "#2D4E6D"],
["#4D5E6C", "#6A89A6"],
["#F3F3F3", "#F5F8FC"],
["#E4E4E4", "#E7F0F7"],
["#FAFAFA", "#F5F8FC"],
["#D3E7FF", "#CFEAFF"],
["#F2FDFF", "#F7FBFD"],
["#F1C40F", "#FFB800"],
["#4F6F8F", "#87AACA"],
["#32A49A", "#329FAE"],
["#D1D4D9", "#D6E5F2"],
["#aaa", "#B2C9DE"],
["#CBD8E2", "#B2C9DE"],
["#3B5160", "#6A89A6"],
["#CFD9DB", "#D6E5F2"],
["#F6FFFA", "#E2FFEA"],
["#C7FFE0", "#A9FFDC"],
["#E7F2FF", "#E3F3FF"],
["#CEE4FF", "#CFEAFF"],
["#8A8A8A", "#B2C9DE"],
["#8CA5AB", "#6A89A6"],
["#333", "#2D4E6D"],
["#DBECFF", "#E3F3FF"],
["#8A97A6", "#6A89A6"],
["#C58EF4", "#3B7CC9"],
["#E28888", "#F65050"],
["#DBF6FF", "#E3F3FF"],
["#FFF792", "#FFB800"],
["#FADE00", "#FFB800"],
["#8C5600", "#E89B06"],
["#ECEBEB", "#E7F0F7"],
["#8B8B8B", "#B2C9DE"],
["#E5F3FB", "#E7F0F7"],
["#bbb", "#D6E5F2"],
["#6C6C6C", "#6A89A6"],
["#778E9C", "#6A89A6"],
["#EFEFEF", "#E7F0F7"],
["#767676", "#6A89A6"],
["#292929", "#2D4E6D"],
["#B22ECC", "#1D5BA4"],
["#7DE0E3", "#329FAE"],
["#F2F2F2", "#F5F8FC"],
["#E1E1E1", "#E7F0F7"],
["#A2ACB3", "#B2C9DE"],
["#3D8AE9", "#3B7CC9"],
["#5E5E5E", "#6A89A6"],
["#BDC9D4", "#B2C9DE"],
["#343739", "#2D4E6D"],
["#FFFFFF", "#FFFFFF"],
["#10AE53", "#2B9D7B"],
["#6F88A0", "#6A89A6"],
["#128274", "#329FAE"],
["#128179", "#329FAE"],
["#A8BBCF", "#B2C9DE"],
["#123", "#2D4E6D"],
["#160", "#2B9D7B"],
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment