Building scoreboard displays

SolidConnect scoreboards are styled entirely with CSS. Each sport has one fixed HTML structure, filled with sample data here and live data on a real board. A display is a single stylesheet that lays it out.

Overview

  1. The HTML is fixedEvery display for a sport styles the same markup. Don't change it, and don't rely on changes to it.
  2. CSS is the designA display is one stylesheet, scoped to its own class, that shows, hides, sizes and places the elements.
  3. Displays load by name?theme=<name> on a sport page loads assets/displays/<sport>/<name>.css.

This site gives you the sport pages with sample data, every existing display to learn from, a viewer for checking a display at any screen size with worst-case data, and a playground for writing CSS without cloning the repo.

Quick start

Without the repo

  1. Find an existing display close to what you want on the Displays page and open it.
  2. Choose New display in the playground panel to start from a copy of it, give it your own name and change the CSS. The preview updates as you type.
  3. Check it at your board's size and with the test data switched on, then download the file or get a share link.

With the repo

  1. Serve the repository root over http. Opening the files directly mostly works, but the playground, test data and markup reference need http:
    php -S localhost:8000
  2. Copy a similar display under assets/displays/<sport>/, rename it and rewrite its selectors to the new class.
  3. Open it at <sport>.html?theme=<name>, or in the viewer at view.html?sport=<sport>&theme=<name> once it's in assets/themes.js.

Creating a display

Each sport has its own page and display folder:

SportPageNotes
Australian Rulesaustralianrules.htmlGoals, behinds and total per team.
Cricketcricket.htmlBatting team score, overs, target, batting and bowling tables. No team-vs-team layout.
Soccersoccer.htmlOne total per team.
Rugby Unionrugbyunion.htmlSoccer's markup plus a scoreboard__summary block (tries, conversions, drop goals, penalties).
Rugby Leaguerugbyleague.htmlRugby Union's, with field goals in place of drop goals.
Field Hockeyfieldhockey.htmlSame as Soccer.
Gaelic Footballgaelicfootball.htmlAustralian Rules' markup, with team__points in place of team__behinds.

The page puts a class on #scoreboard built from the sport and display name. Scope every rule to it, so displays can't affect each other:

/* assets/displays/cricket/my-new-display.css */
.scoreboard--cricket-my-new-display {
  --bg-color: #000;
  --text-color: #fff;
  background-color: var(--bg-color);
  color: var(--text-color);
  height: 100vh;
  container-type: size;
}

.scoreboard--cricket-my-new-display .header__score {
  font-size: 40cqh;
}

Display names that start with ads- get the class scoreboard--ads-<sport>-<rest> instead, e.g. ads-score-1 on Soccer is .scoreboard--ads-soccer-score-1. Only ads- displays get the full-screen ad area (scoreboard__ads). Shared displays (assets/displays/<name>.css, e.g. on-scoreboard-ads) work on every sport page and use an unprefixed scoreboard--<name>. The viewer shows the exact class for every display.

Start from the closest existing display rather than from scratch: they show how each element is usually handled, and many are close to a new design already.

Markup reference

The elements inside #scoreboard for each sport, read from the sport page itself so it's always current. Repeated rows are collapsed (×9), and grey text is the sample data.

Loading…

Classes follow BEM: blocks are scoreboard__* sections, and the elements inside are named after their section (header__clock, team__name, batting__runs). The home and away teams share markup, distinguished by scoreboard__team--home and --away.

Don't select by position. Hidden elements still count for :first-child, :last-child and :nth-child(), and the end of every header and footer holds hidden Display Graphics. Select by class.

Sizing and responsiveness

Boards range from 160 × 112 LED panels to 1920 × 1080 screens, and the same display may run on a slightly different shape than it was designed for. Every display should fill whatever box it's given without overflowing.

  • Make the root a size container. height: 100vh; container-type: size; on the display class, then size everything in cqh/cqw so it scales with the board, not the browser.
  • Swap to width-based sizes on narrower screens. Text sized in cqh overflows when the board is narrower than designed. Add a container query at the design ratio that switches to cqw:
    .scoreboard--cricket-my-display .scoreboard__display {
      --u: 1cqh;
    }
    
    /* Designed for 288 × 96 (3:1): narrower boards scale with the width */
    @container (max-aspect-ratio: 3/1) {
      .scoreboard--cricket-my-display .scoreboard__display {
        --u: calc(1cqw / 3);
      }
    }
    
    .scoreboard--cricket-my-display .header__score {
      font-size: calc(40 * var(--u));
    }
    Defining one unit (--u) and sizing everything in multiples of it means there's one breakpoint to maintain rather than one per element. Many recent displays work this way.
  • Text boxes are trimmed to the cap height. assets/main.css sets text-box: trim-both cap alphabetic on everything, so a text box runs from the top of the capitals to the baseline. That makes alignment predictable, but descenders (g, p, y) sit outside the box: under overflow: hidden they're cut off. Use overflow-x: clip; overflow-y: visible, or set text-box: normal on that element.
  • Leave the emergency displays' approach alone. emergency-score-* displays are overlays a fraction of the window in size, so they use vw/vh and @media queries instead.
  • Check worst cases. Use the viewer's test data (long team names, big scores, all out, long player names, no required rate) and its sizes, including dragging the corner to an awkward shape.

App behaviour

The sport pages load assets/app.css and assets/app.js, which copy what the scoreboard app does with its rendered markup, so a display looks and moves here the way it will on a board. Don't restyle them: they track the app.

Scrolling messages

header__messages/footer__messages are also ticker-viewport, and each message is a ticker-text (absolutely positioned, white-space: nowrap). One message at a time starts just off the right edge and slides left at 0.1px/ms until it's gone. The viewport has no position of its own, so give *__messages position: relative to keep messages inside it. A hidden (0 × 0) viewport doesn't scroll.

Rotating ads

header__ad/footer__ad (On Scoreboard ads) and scoreboard__ads (full-screen ads) stack every ad in the same box (asset-1, asset-2, …) and crossfade every 5 seconds. Ad images are contained, not cropped, so a slot of a different shape letterboxes them. The header and footer ads are only rendered while their slot isn't display: none, and scoreboard__ads only exists for ads- displays.

Name truncation

Team names (team__name; in Cricket header__batting-team, footer__batting-team, batting__team, bowling__team and player names) that overflow their box are cut short with a full stop, e.g. "Greater Western Sydney Gi.". This only happens when the box is narrower than the text (scrollWidth > clientWidth): a box that grows to fit is never truncated. A name inside a flex item can stretch the item past its parent, which then clips the name instead, so give those items min-width: 0. Truncation re-runs on resize and when web fonts load.

Optional and conditional elements

Some elements are in the markup but hidden by default, or only rendered by the app in some situations. Plan for both cases.

Display Graphics

The last child of every sport's scoreboard__header and scoreboard__footer is header__graphics/footer__graphics, holding up to four images, header__graphic--custom-1 to --custom-4. They're the scoreboard's Display Graphics in Craft, numbered by their position there, so a board may have fewer, or skip a number. main.css hides both wrappers; a display that uses them opts in, then sizes and places each box (the image fills it, contained):

.scoreboard--australianrules-my-display .header__graphics {
  display: flex;
}

Say what each number is for (e.g. custom-1 = club logo, custom-2 = sponsor banner): that's what scoreboard admins match in Craft.

Cricket team logos

header__batting-logo, footer__batting-logo and batting__logo hold the batting team's logo, and bowling__logo the bowling team's, each just before the team name. Every cricket display hides all four with its own rule at the end of the file ("Team logos — hidden"), so a new cricket display needs that rule too, minus any logo it shows. A team without a logo shows the app's fallback logo.

Cricket over line

header__overline/footer__overline list the current over's deliveries as overline__ball spans, with modifiers: --dot, --runs, --four, --six, --extra plus --wd/--nb/--lb/--b, --illegal and --wicket. The app only renders it with PlayHQ scoring, and most displays hide it with their own rule, so add one unless you show it. Space the balls with gap, not inline whitespace.

Cricket extras breakdown

header__extras-breakdown/footer__extras-breakdown list the batting team's extras by type (B, L, N, Wd, P, e.g. "B12 L13 N14 Wd15 P5") as extras-breakdown__item spans (--b/--lb/--nb/--wd/--p), each holding an extras-breakdown__code and an extras-breakdown__count. Only types above 0 are shown. The app only renders it with PlayHQ scoring, and every display hides it with its own rule, so leave that rule out to show it. Space the items with gap, not inline whitespace.

Cricket rows and rates

  • Bowlers are listed in bowling order. The current bowler's row has bowling__current and the one before has bowling__previous. To show only the current bowler, hide tbody tr and show tr.bowling__current.
  • Batsmen who are out have batting__out; the striker has batting__current.
  • *__run-rate-req is only rendered while there's a target. Check the display with No required rate on.
  • span.bowling__innings in the bowling header shows "Innings: N". Hide it unless you want it.
  • The target label is Tar, Lead or Trail in the app, so don't replace its text with your own.

Fonts

Load a custom typeface with a Google Fonts @import at the top of the display's CSS file:

@import url('https://fonts.googleapis.com/css2?family=Khand:wght@300;400;500;600;700&display=swap');

.scoreboard--australianrules-my-display {
  font-family: "Khand", Arial, sans-serif;
}

Only Google Fonts (fonts.googleapis.com and fonts.gstatic.com) is allowed through on venue networks, and some venues block it too, so always end the stack with a fallback that fits. The default font is Arial.

Use bold, not 900, with Arial. Windows draws Arial at weight 900 as Arial Black, which is much wider and can run a score off the board. macOS has no 900 Arial, so you won't see the problem there.

Colour variables

Each club's colours come from the app as custom properties, so one display works for every club:

VariableSet by
--home-primary, --home-secondaryThe app, per match
--away-primary, --away-secondaryThe app, per match
--bg-color, --text-color, --border-color, …Your display
.scoreboard--australianrules-my-display .scoreboard__team--home {
  background: var(--home-primary);
  color: var(--home-secondary);
}

The sport pages define sample values in a :root block; on a board the app sets the real ones.

Previewing and sharing

The viewer shows any display at its designed size or any other, at actual pixels (Actual) or scaled to fit (Fit). Drag the corner handle to try odd shapes, and switch on test data to check worst cases. Its URL keeps all of that, so you can send someone exactly what you're looking at.

The playground panel edits CSS live against the sport's markup:

  • New display starts from a copy of the display you're on, renamed my-display, so you begin from something that works. Edit this display loads its CSS under its own name.
  • The display name sets the scope class, shown under the name field. Renaming the display renames the class throughout the CSS too.
  • Picking another display from the menu starts again from that one (it asks first if you've made changes).
  • Drop a .css file on the editor, or use Open file, to load your own.
  • Your work is kept in this browser, so a reload doesn't lose it, and the Playground link reopens it. Reset goes back to where you started.
  • Get share link uploads a draft and gives you a link to it at the current size, copied to your clipboard. Uploading again with the same name updates the same link.

Drafts are previews only: they live outside assets/displays/ and aren't part of the display library. Uploads are size-capped, external resources are limited to Google Fonts, and each sport has a cap on stored drafts. The old upload page redirects here, and old preview links still open their draft.

Delivering your CSS

When the display is ready, send the CSS to the Solid team so they can add it to the live scoreboard system.

  1. Download the file from the playground, or take it from assets/displays/<sport>/.
  2. Email it to your Solid contact, with the display name, the sport, and the board size it's for.
  3. If it uses Display Graphics, say what each number is for.

The Solid team adds the file to the scoreboard app and configures it against the relevant scoreboards.

Adding a display to the gallery

The gallery and viewer are built from assets/themes.js, one line per display:

{ sport: 'cricket', slug: 'basic-score-9', size: [288, 96] },
  • size is the board size it was designed for, in pixels. Previews render at that size and are scaled down, so pixel-tuned displays look right. If you only know the shape, use that ratio at about 768px on the long side (16:9 is [768, 432]), except Big screen displays, which are [1920, 1080]. Use null for "any size".
  • Optional: status: 'wip' (pending approval), shown as a WIP badge in the gallery and viewer.
  • Optional: note for a one-line description, and inApp: false until the display is in the scoreboard app.

The display's name, family and shape come from its slug and size: basic-score-8b is shown as "Basic - Score 8b", as in the scoreboard app. So name it after its family: basic-, standard-, strip-, big-screen-, portrait-, ads-, emergency- or custom-.

Project structure

.
├── index.html            # Displays: the display gallery
├── view.html             # Viewer and CSS playground
├── documentation.html    # These docs
├── all/index.html        # Redirects to the gallery (old /all links)
├── australianrules.html  # Fixed scoreboard markup with sample data, one page per sport
├── cricket.html
├── soccer.html
├── rugbyunion.html
├── rugbyleague.html
├── fieldhockey.html
├── gaelicfootball.html
├── test.html             # Test harness for shared display CSS
├── upload.php            # Saves playground drafts to uploads/
├── upload.html           # Redirects to the playground (old links)
├── assets/
│   ├── themes.js         # The display list behind the gallery and viewer
│   ├── site.css          # Styles for the gallery, viewer and docs
│   ├── site.js           # Shared helpers for those pages
│   ├── gallery.js        # Gallery
│   ├── viewer.js         # Viewer and playground
│   ├── docs.js           # Docs: contents, copy buttons, markup reference
│   ├── main.css          # Base styles for the scoreboard pages
│   ├── app.css           # The scoreboard app's own styles (ticker, ads)
│   ├── app.js            # The app's ticker, ad rotation and name truncation
│   └── displays/
│       ├── <sport>/      # One folder of displays per sport
│       └── *.css         # Shared displays (e.g. on-scoreboard-ads)
├── CHANGELOG.md
└── README.md

Versioning

See CHANGELOG.md for the release history.