Okay, here is an HTML structure with inline CSS for an iRacing leaderboard overlay, incorporating Fluent Design principles and the requested features.
Explanation of Design Choices:
-
Fluent Design Elements:
- Acrylic Background: Achieved using
background-color with alpha transparency (rgba) combined with backdrop-filter: blur(). This gives the semi-transparent, blurred look common in Fluent Design, allowing the game underneath to peek through.
- Soft Corners:
border-radius is applied to the main container.
- Subtle Shadows: A gentle
box-shadow adds depth and helps lift the overlay off the background.
- Clean Typography: Uses
Segoe UI as the primary font (common in Windows/Fluent), with good fallbacks.
- Clear Hierarchy: Font weights and colors differentiate header, player row, and standard rows.
-
Visual Cues:
- Player Row: Highlighted with a distinct, slightly brighter background color (
player-row class).
- Safety Rating (SR): Uses colored
<span> elements within the SR cell. Each class (sr-a to sr-r) has a unique, easily recognizable color and a subtle background for emphasis. The colors chosen are common conventions (A=Green/Blue, B=Yellow, C=Orange, D=Red, R=Grey).
- Gap (+/-): The sign is explicitly shown. The color of the gap text changes: Green (
gap-positive) for players ahead (positive gap to them), Red (gap-negative) for players behind (negative gap to them). Self is used for the player's own gap.
- Fastest Lap: The lap time cell for the driver with the fastest lap gets the
fastest-lap class, making the text purple and bold (a common simracing convention).
- Readability: Sufficient padding, clear font, and
white-space: nowrap prevent awkward text wrapping, especially for names and times. text-overflow: ellipsis handles names that are too long.
-
Structure:
- Uses a standard HTML
<table> for structured data.
<thead> for column headers.
<tbody> for driver data.
- Classes are used extensively to target specific elements for styling without overly complex CSS selectors.
HTML with Inline CSS:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>iRacing Leaderboard Overlay</title>
<style>
/* --- Base Styles & Fluent Design --- */
body {
/* For demo purposes only - make background visible */
background: url('https://via.placeholder.com/1920x1080/cccccc/969696?text=Sim+Background') no-repeat center center fixed;
background-size: cover;
font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
margin: 0;
padding: 20px; /* Demo spacing */
}
.leaderboard-overlay {
position: fixed; /* Or absolute, depending on injection method */
top: 20px;
right: 20px;
width: 450px; /* Adjust width as needed */
background-color: rgba(30, 30, 30, 0.8); /* Dark Acrylic */
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px); /* Safari support */
border-radius: 8px; /* Soft corners */
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3); /* Subtle shadow */
color: #f0f0f0; /* Light text color */
font-size: 14px;
overflow: hidden; /* Ensure contents respect border-radius */
}
/* --- Table Styling --- */
.leaderboard-overlay table {
width: 100%;
border-collapse: collapse; /* Clean lines */
}
.leaderboard-overlay th,
.leaderboard-overlay td {
padding: 6px 10px; /* Cell padding */
text-align: left;
white-space: nowrap; /* Prevent text wrapping */
}
.leaderboard-overlay th {
background-color: rgba(0, 0, 0, 0.2); /* Slightly darker header */
font-weight: 600;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
font-size: 12px;
text-transform: uppercase;
color: #cccccc;
}
.leaderboard-overlay td {
border-bottom: 1px solid rgba(255, 255, 255, 0.05); /* Subtle row separator */
}
.leaderboard-overlay tr:last-child td {
border-bottom: none; /* No border on the last row */
}
/* --- Column Alignment & Widths --- */
.leaderboard-overlay .col-pos { width: 8%; text-align: center; }
.leaderboard-overlay .col-name { width: 35%; overflow: hidden; text-overflow: ellipsis; }
.leaderboard-overlay .col-last { width: 17%; text-align: right; }
.leaderboard-overlay .col-gap { width: 15%; text-align: right; }
.leaderboard-overlay .col-ir { width: 13%; text-align: right; }
.leaderboard-overlay .col-sr { width: 12%; text-align: center; }
/* --- Visual Cues --- */
/* Player Row Highlight */
.leaderboard-overlay .player-row {
background-color: rgba(80, 120, 200, 0.3); /* Subtle blueish highlight */
font-weight: 600; /* Slightly bolder text */
}
.leaderboard-overlay .player-row td {
border-bottom-color: rgba(80, 120, 200, 0.4);
}
.leaderboard-overlay tr.player-row + tr td {
/* Ensure separator below player row is also distinct if needed */
/* border-top: 1px solid rgba(80, 120, 200, 0.4); */
}
/* Safety Rating Colors */
.leaderboard-overlay .sr-badge {
display: inline-block;
padding: 2px 6px;
border-radius: 4px;
font-weight: 700;
font-size: 12px;
min-width: 25px; /* Ensure consistent width */
text-align: center;
color: #ffffff; /* White text on colored background */
}
.leaderboard-overlay .sr-a { background-color: #1a7a3f; } /* Green */
.leaderboard-overlay .sr-b { background-color: #d1a11e; } /* Yellow */
.leaderboard-overlay .sr-c { background-color: #d15e1e; } /* Orange */
.leaderboard-overlay .sr-d { background-color: #b81e1e; } /* Red */
.leaderboard-overlay .sr-r { background-color: #888888; color: #222; } /* Grey */
/* Gap +/- Coloring */
.leaderboard-overlay .gap-positive { color: #60d860; } /* Light Green */
.leaderboard-overlay .gap-negative { color: #ff6b6b; } /* Light Red */
.leaderboard-overlay .gap-self { font-style: italic; color: #cccccc; }
/* Fastest Lap Highlight */
.leaderboard-overlay .fastest-lap {
color: #d783ff; /* Purple */
font-weight: 700; /* Bold */
}
/* Optional: Add a small icon - Requires FontAwesome or similar */
/*
.leaderboard-overlay .fastest-lap::before {
content: "\f005"; // Example: FontAwesome star icon
font-family: "Font Awesome 5 Free";
font-weight: 900;
margin-right: 4px;
color: #d783ff;
}
*/
</style>
</head>
<body>
<div class="leaderboard-overlay">
<table>
<thead>
<tr>
<th class="col-pos">Pos</th>
<th class="col-name">Driver</th>
<th class="col-last">Last</th>
<th class="col-gap">Gap</th>
<th class="col-ir">iR</th>
<th class="col-sr">SR</th>
</tr>
</thead>
<tbody>
<!-- Sample Data: Player is P5 -->
<tr>
<td class="col-pos">3</td>
<td class="col-name">A. Speedster</td>
<td class="col-last">1:34.882</td>
<td class="col-gap"><span class="gap-positive">+12.5</span></td>
<td class="col-ir">4580</td>
<td class="col-sr"><span class="sr-badge sr-a">A 4.1</span></td>
</tr>
<tr>
<td class="col-pos">4</td>
<td class="col-name">B. Quickley</td>
<td class="col-last fastest-lap">1:34.501</td> <!-- Fastest lap example -->
<td class="col-gap"><span class="gap-positive">+3.1</span></td>
<td class="col-ir">3120</td>
<td class="col-sr"><span class="sr-badge sr-b">B 3.5</span></td>
</tr>
<tr class="player-row"> <!-- Player Row -->
<td class="col-pos">5</td>
<td class="col-name">You (Player Name)</td>
<td class="col-last">1:35.105</td>
<td class="col-gap"><span class="gap-self">Self</span></td>
<td class="col-ir">2855</td>
<td class="col-sr"><span class="sr-badge sr-c">C 2.8</span></td>
</tr>
<tr>
<td class="col-pos">6</td>
<td class="col-name">C. SteadyHands Jr. Long Name Test Ellipsis</td>
<td class="col-last">1:35.990</td>
<td class="col-gap"><span class="gap-negative">-1.8</span></td>
<td class="col-ir">1988</td>
<td class="col-sr"><span class="sr-badge sr-d">D 1.2</span></td>
</tr>
<tr>
<td class="col-pos">7</td>
<td class="col-name">D. Rookie</td>
<td class="col-last">1:37.012</td>
<td class="col-gap"><span class="gap-negative">-5.4</span></td>
<td class="col-ir">1500</td>
<td class="col-sr"><span class="sr-badge sr-r">R 2.5</span></td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
How to Use:
- Save: Save this code as an HTML file (e.g.,
iracing_overlay.html).
- Integrate: You would typically use this with an overlay tool (like OBS with a Browser Source, or dedicated simracing overlay software like RaceLab, Kapps, Joel Real Timing, etc.) that can render HTML/CSS. Point the tool to this local file or host it.
- Dynamic Data: The crucial next step (outside the scope of this pure HTML/CSS design) is to connect this overlay to iRacing's live telemetry data. This requires software that reads the iRacing API and dynamically updates the content within the
<tbody> of the table using JavaScript or the overlay tool's built-in data binding features. The sample data provided would be replaced with live data. The classes (player-row, fastest-lap, sr-a, gap-positive, etc.) would need to be applied dynamically based on the incoming data.