@@ -225,8 +225,31 @@ function rebuildTable() {
225
225
solutions . forEach ( ( solution ) => {
226
226
const row = table . insertRow ( - 1 ) ;
227
227
row . insertCell ( 0 ) . innerText = solution . id . toString ( ) ;
228
- const difficultyText = solution . difficulty === 1 ? 'Easy' : solution . difficulty === 2 ? 'Medium' : 'Hard' ;
229
- row . insertCell ( 1 ) . innerText = difficultyText || 'N/A' ;
228
+
229
+ // Get the difficulty level
230
+ const difficulty = solution . difficulty ;
231
+ const difficultyCell = row . insertCell ( 1 ) ;
232
+ let difficultyText = '' ;
233
+ let color = '' ;
234
+
235
+ // Define the difficulty text and background color
236
+ if ( difficulty === 1 ) {
237
+ difficultyText = 'Easy' ;
238
+ color = 'lightgreen' ;
239
+ } else if ( difficulty === 2 ) {
240
+ difficultyText = 'Medium' ;
241
+ color = 'orange' ;
242
+ } else {
243
+ difficultyText = 'Hard' ;
244
+ color = 'red' ;
245
+ }
246
+
247
+ difficultyCell . innerText = difficultyText || 'N/A' ;
248
+ difficultyCell . style . color = color ;
249
+ difficultyCell . style . fontWeight = 'bold' ;
250
+ difficultyCell . style . fontSize = '10px' ;
251
+ difficultyCell . style . borderRadius = '5px' ; // Apply border radius
252
+
230
253
row . insertCell ( 2 ) . innerHTML = `<a href="${ solution . url } " target="_blank">${ solution . title } </a>` ;
231
254
row . insertCell ( 3 ) . innerText = ( solution . acceptance ? ( solution . acceptance * 100 ) . toFixed ( 2 ) + '%' : 'N/A' ) ; // New column for acceptance
232
255
@@ -244,7 +267,6 @@ function rebuildTable() {
244
267
}
245
268
246
269
247
-
248
270
// Keep track of the sorting order for each column
249
271
const sortOrders = {
250
272
'#' : false ,
0 commit comments