File tree Expand file tree Collapse file tree 1 file changed +20
-65
lines changed Expand file tree Collapse file tree 1 file changed +20
-65
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,24 @@ const weightWordCount = 0.5;
83
83
const minFontSize = 12;
84
84
const maxFontSize = 32;
85
85
const tagsFilter = [ " #tag1" , " #tag2" ];
86
+ const arrColors = [];
87
+
88
+ /*
89
+ Generate 40 colors
90
+ * /
91
+
92
+ for ( let i = 0; i < 40; i++ )
93
+ {
94
+
95
+ let R = Math.floor( ( Math.random( ) * 100 ) + 100 );
96
+ let G = Math.floor( ( Math.random( ) * 100 ) + 100 );
97
+ let B = Math.floor( ( Math.random( ) * 100 ) + 100 );
98
+
99
+ let rgb = ( R << 16 ) + ( G << 8 ) + B;
100
+ let itemColor = ` # ${rgb.toString( 16 )}` ;
101
+
102
+ arrColors.push( itemColor );
103
+ }
86
104
87
105
/*
88
106
Get all backlinks
@@ -136,74 +154,11 @@ function Generate_FontSize( backlinks, wordCount )
136
154
function Generate_Color( tagName )
137
155
{
138
156
if ( tagName == null ) { return "#FFFFFF"; }
139
- const colors =
140
- {
141
- " grey-01" : " #636363" ,
142
- " grey-02" : " #777777" ,
143
- " grey-03" : " #8e8e8e" ,
144
- " F79393" : " #F79393" ,
145
- " C72E6C" : " #C72E6C" ,
146
- " F2930B" : " #F2930B" ,
147
- " 558ACF" : " #558ACF" ,
148
- " e04a3d" : " #e04a3d" ,
149
- " FFA5D8" : " #FFA5D8" ,
150
- " F3D910" : " #F3D910" ,
151
- " E823A1" : " #E823A1" ,
152
- " 00A6FF" : " #00A6FF" ,
153
- " 65B08F" : " #65B08F" ,
154
- " 3A6671" : " #3A6671" ,
155
- " AE3B40" : " #AE3B40" ,
156
- " d4785c" : " #d4785c" ,
157
- " b63277" : " #b63277" ,
158
- " e27f32" : " #e27f32" ,
159
- " f5d58a" : " #f5d58a" ,
160
- " 6A9358" : " #6A9358" ,
161
- " D35A1E" : " #D35A1E" ,
162
- " F27929" : " #F27929" ,
163
- " F2982C" : " #F2982C" ,
164
- " FADD43" : " #FADD43" ,
165
- " ffc562" : " #ffc562" ,
166
- " 4fddc3" : " #4fddc3" ,
167
- " 61a8e8" : " #61a8e8" ,
168
- " DB02C2" : " #DB02C2" ,
169
- " FA01B3" : " #FA01B3" ,
170
- " 6B7485" : " #6B7485" ,
171
- " 99A3A0" : " #99A3A0" ,
172
- " 7D898A" : " #7D898A" ,
173
- " fe0052" : " #fe0052" ,
174
- " ff40b7" : " #ff40b7" ,
175
- " fd0188" : " #fd0188" ,
176
- " ffd700" : " #ffd700" ,
177
- " d78f00" : " #d78f00" ,
178
- " 658035" : " #658035" ,
179
- " FFC312" : " #FFC312" ,
180
- " 12CBC4" : " #12CBC4" ,
181
- " FDA7DF" : " #FDA7DF" ,
182
- " ED4C67" : " #ED4C67" ,
183
- " F79F1F" : " #F79F1F" ,
184
- " 1289A7" : " #1289A7" ,
185
- " D980FA" : " #D980FA" ,
186
- " B53471" : " #B53471" ,
187
- " EE5A24" : " #EE5A24" ,
188
- " 009432" : " #009432" ,
189
- " 9980FA" : " #9980FA" ,
190
- " 5758BB" : " #5758BB" ,
191
- " ef7c8e" : " #ef7c8e" ,
192
- " b6e2d3" : " #b6e2d3" ,
193
- " d8a7b1" : " #d8a7b1" ,
194
- " d48c70" : " #d48c70" ,
195
- " e98980" : " #e98980" ,
196
- " 01949a" : " #01949a" ,
197
- " 04ecf0" : " #04ecf0" ,
198
- " 04d4f0" : " #04d4f0" ,
199
- " 6af2f0" : " #6af2f0" ,
200
- " 059dc0" : " #059dc0" ,
201
- };
202
157
203
158
const tagWords = tagName.split( /\W+/g );
204
- const colorIndex = tagWords.reduce( ( total, word ) => total + word.charCodeAt( 0 ), 0 ) % Object.keys( colors ).length;
159
+ const colorIndex = tagWords.reduce( ( total, word ) => total + word.charCodeAt( 0 ), 0 ) % Object.keys( arrColors ).length;
205
160
206
- return colors [ Object.keys( colors )[ colorIndex ] ];
161
+ return arrColors [ Object.keys( arrColors )[ colorIndex ] ];
207
162
}
208
163
209
164
/*
You can’t perform that action at this time.
0 commit comments