Below is an example of an HTML snippet that implements a leaderboard overlay for iRacing using Fluent-inspired design principles. In this example, we display five rows – the “player” is shown in the middle (position 3) with two rows above and two below. Colors and styling highlight safety ratings, the gap (positive/negative), the fastest lap (by applying a “medal” glow), and especially the player’s own row.
You can customize the sample data and adjust the CSS as needed.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>iRacing Leaderboard Overlay</title>
<style>
/* Base reset */
body {
margin: 0;
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
background: rgba(0,0,0,0.6);
color: #f0f0f0;
}
/* Container style with Fluent Acrylic effect */
.leaderboard-container {
width: 500px;
margin: 20px auto;
background: rgba(255,255,255,0.1);
backdrop-filter: blur(10px);
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0,0,0,0.3);
overflow: hidden;
}
/* Table styling */
table {
width: 100%;
border-collapse: collapse;
}
th, td {
padding: 10px 12px;
text-align: left;
font-size: 14px;
}
th {
background-color: rgba(255,255,255,0.15);
border-bottom: 1px solid rgba(255,255,255,0.2);
}
tr:not(.player):hover {
background-color: rgba(255,255,255,0.05);
}
/* Highlight the player's row */
.player {
background-color: rgba(0, 120, 215, 0.4);
font-weight: bold;
}
/* Safety Rating colors */
.rating-A { color: #4caf50; } /* green */
.rating-B { color: #8bc34a; } /* light green */
.rating-C { color: #ffeb3b; } /* yellow */
.rating-D { color: #ff9800; } /* orange */
.rating-R { color: #f44336; } /* red */
/* Gap styling: plus (ahead) in green, minus (behind) in red */
.gap-positive { color: #66bb6a; }
.gap-negative { color: #ef5350; }
/* Fastest Lap Indicator (for demonstration, we add a glowing medal effect) */
.fastest-lap {
display: inline-block;
padding: 2px 6px;
margin-left: 8px;
background: linear-gradient(45deg, #ffd700, #ffec8b);
border-radius: 4px;
box-shadow: 0 0 6px 2px rgba(255, 215, 0, 0.8);
font-size: 12px;
color: #5c3a00;
}
/* Header row style */
thead tr {
border-bottom: 2px solid rgba(255,255,255,0.3);
}
</style>
</head>
<body>
<div class="leaderboard-container">
<table>
<thead>
<tr>
<th>Position</th>
<th>Driver Name</th>
<th>Last Lap Time</th>
<th>Gap to Player</th>
<th>iRating</th>
<th>Safety Rating</th>
</tr>
</thead>
<tbody>
<!-- Row above the player's row -->
<tr>
<td>1</td>
<td>SpeedDemon</td>
<td>1:21.345 <span class="fastest-lap">Fastest</span></td>
<td class="gap-positive">+2.34s</td>
<td>2150</td>
<td class="rating-A">A</td>
</tr>
<tr>
<td>2</td>
<td>FalconEye</td>
<td>1:21.876</td>
<td class="gap-positive">+1.12s</td>
<td>2080</td>
<td class="rating-B">B</td>
</tr>
<!-- Player Row -->
<tr class="player">
<td>3</td>
<td>YourName</td>
<td>1:22.500</td>
<td>--</td>
<td>2100</td>
<td class="rating-C">C</td>
</tr>
<!-- Row below the player's row -->
<tr>
<td>4</td>
<td>RapidRacer</td>
<td>1:23.100</td>
<td class="gap-negative">-0.75s</td>
<td>2050</td>
<td class="rating-D">D</td>
</tr>
<tr>
<td>5</td>
<td>TurboTony</td>
<td>1:23.678</td>
<td class="gap-negative">-1.45s</td>
<td>2025</td>
<td class="rating-R">R</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
Explanation
-
Fluent Acrylic Container:
The .leaderboard-container uses a semi-transparent background with a blurred backdrop to emulate Fluent Design’s acrylic material.
-
Player Highlight:
The player’s row uses the class player for a distinctive blue background and bold text.
-
Safety Rating Colors:
CSS classes such as .rating-A, .rating-B, etc., provide color coding for different safety ratings.
-
Gap Styling:
The .gap-positive and .gap-negative classes color the gap text green or red depending on whether the driver is ahead or behind the player.
-
Fastest Lap Indicator:
A glowing badge is added next to the lap time for the fastest lap, making it stand out.
Feel free to modify the colors, fonts, and sample data to suit your needs or to integrate it with dynamic data in your simracing overlay.