Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI

on:
push:
branches: [main]
pull_request:

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

permissions:
contents: read

jobs:
checks:
name: Install lint and tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
cache: npm

- name: Install dependencies
run: npm ci --ignore-scripts

# The check an instance runs when a board installs the theme, run on the
# packed tarball rather than on the sources.
- name: Install lint
run: npm run lint

- name: Test
run: npm test
124 changes: 124 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# Releases the theme when a `v<version>` tag is pushed.
#
# The catalog lists a theme only if its tarball is an asset of an immutable
# release made by this workflow, on a GitHub-hosted runner, for the release's
# own tag, and carries an attestation from that run (see "The release workflow
# runs on the tag" in the plugin contract of openbrf/openbrf). So this starts
# on the tag push and nowhere else: a run on main, or one started by hand,
# would make an attestation the catalog refuses.
#
# To release: set `version` in theme.json and package.json in a pull request,
# merge it, then push the tag from the merged commit:
#
# git tag v0.1.0 && git push origin v0.1.0
#
# Create no release in the GitHub UI first. Publishing a release with a new tag
# creates the tag, the tag push then starts this workflow after the release is
# already immutable, and the upload of the tarball fails.
#
# The tarball is packed once, attested, and attached to the release before the
# release is published, because the assets of an immutable release cannot
# change afterwards.
name: Release

on:
push:
tags: ["v*"]

concurrency:
group: release
cancel-in-progress: false

permissions:
contents: read

jobs:
release:
name: Pack, attest and release
runs-on: ubuntu-latest
permissions:
# Create the release and upload the tarball.
contents: write
# Attest the tarball.
id-token: write
attestations: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# Whole history, to tell whether the tagged commit is on main.
fetch-depth: 0
# Nothing here pushes, so the token has no reason to sit in the
# runner's git config where later steps and scripts can read it.
persist-credentials: false

- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc

# A tag is cheap to push from anywhere, so the run refuses one that is
# not main's own commit and one that does not match the version the
# manifest states.
- name: Check the tag
env:
TAG: ${{ github.ref_name }}
run: |
if ! git merge-base --is-ancestor "$GITHUB_SHA" origin/main; then
echo "::error::$TAG is not on main. Merge the release first, then tag the merged commit."
exit 1
fi
version=$(node -p 'require("./theme.json").version')
if [ "$TAG" != "v$version" ]; then
echo "::error::The tag is $TAG but theme.json states version $version."
exit 1
fi
if [ "$(node -p 'require("./package.json").version')" != "$version" ]; then
echo "::error::package.json and theme.json state different versions."
exit 1
fi

- name: Install dependencies
run: npm ci --ignore-scripts

- name: Install lint
run: npm run lint

- name: Test
run: npm test

- name: Pack
id: pack
run: |
file=$(node scripts/pack.mjs)
echo "file=$file" >> "$GITHUB_OUTPUT"

- name: Attest the tarball
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
with:
subject-path: ${{ steps.pack.outputs.file }}

# Created as a draft, so the tarball is attached before the release is
# published and becomes immutable.
- name: Create the release
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
FILE: ${{ steps.pack.outputs.file }}
run: |
gh release create "$TAG" "$FILE" \
--draft \
--verify-tag \
--title "$TAG" \
--notes "Release $TAG of the Open BRF example theme. Verify the tarball with: gh attestation verify $(basename "$FILE") --repo $GITHUB_REPOSITORY --source-ref refs/tags/$TAG"
gh release edit "$TAG" --draft=false

# What a catalog entry for this release states.
- name: Report the digest
env:
FILE: ${{ steps.pack.outputs.file }}
run: |
{
echo "### $(basename "$FILE")"
echo
echo "- sha512: \`$(sha512sum "$FILE" | cut -d' ' -f1)\`"
echo "- bytes: \`$(stat -c %s "$FILE")\`"
} >> "$GITHUB_STEP_SUMMARY"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
dist/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
26.12.0
18 changes: 18 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
MIT No Attribution

Copyright 2026 Open BRF contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
83 changes: 82 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,83 @@
# example-theme
Reference Open BRF theme: data-only token set extending the default theme.

The reference theme for [Open BRF](https://github.com/openbrf/openbrf): a
data-only token set that extends the default theme, to start your own from.

It changes what a theme usually changes first. The trust accent is green
instead of brass, in light and dark; controls have a slightly rounder corner;
and the register's monospace face, Spline Sans Mono, is bundled in the package
rather than loaded from anywhere. Everything it does not state it inherits from
`porttavlan`, the default theme.

A theme is pure data: no JavaScript, so installing one needs no restart and
carries no supply-chain risk. The format, every token and the rules a theme is
held to are in the
[token contract](https://github.com/openbrf/openbrf/blob/main/docs/theme-contract.md).

## What is in here

| Path | What it is |
| ------------------------------------ | ------------------------------------------------------- |
| `theme.json` | The manifest: identity, token values, fonts, variants |
| `fonts/spline-sans-mono-latin.woff2` | The bundled typeface |
| `fonts/OFL.txt` | Its licence, which the font requires to travel with it |
| `scripts/pack.mjs` | Packs the theme into `dist/example-theme-<version>.tgz` |
| `scripts/lint.mjs` | Runs the install lint on the packed theme |
| `test/` | The lint as a test, plus a check that it can still fail |

## Making your own

Copy the repository, rename the theme in `theme.json` and `package.json` (a
name is lowercase words joined by hyphens, and unique in the catalog), and
change the values. Then check it the way an instance will:

```sh
npm install
npm run lint # packs the theme and runs the install lint on the tarball
npm test
```

`npm run lint` uses
[`@openbrf/theme-tools`](https://www.npmjs.com/package/@openbrf/theme-tools),
the same package the core runs when a board installs a theme, so you see the
same refusal before you publish. The lint is a gate: it refuses a theme that
renders the statutory register below WCAG AA, one that carries anything
executable, and one that loads a font from outside the package or bundles one
with no licence.

A font you bundle needs its own licence file and a declaration in `theme.json`.
Do not link a font from a CDN: that discloses every viewer's IP address to a
third party.

## Releasing

A release is made by `.github/workflows/release.yml` and only by a pushed tag.
The catalog lists a theme only if its tarball is an asset of an immutable GitHub
release, with a build attestation from that workflow on the release's tag. The
repository needs GitHub's immutable releases setting on before the first one.

1. Set `version` in `theme.json` and `package.json` in a pull request, and merge
it.
2. Tag the merged commit and push the tag:

```sh
git tag v0.1.0
git push origin v0.1.0
```

The workflow refuses a tag that is not on `main` or that does not match the
manifest's version, lints and tests, packs the tarball once, attests it,
attaches it to the release and publishes. Its run summary shows the `sha512`
and size to state in the catalog entry.

Do not publish a release from the GitHub UI first: that creates the tag after
the release is already immutable, and the tarball can no longer be attached.

To be installable from the curated catalog, a release is then listed with a pull
request to [`openbrf/catalog`](https://github.com/openbrf/catalog).

## Licence

[MIT-0](LICENSE): no conditions, so you can start a proprietary theme from this
one without keeping a notice. The bundled font is under the SIL Open Font
License 1.1; see `fonts/OFL.txt`.
93 changes: 93 additions & 0 deletions fonts/OFL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Copyright 2022 The Spline Sans Mono Project Authors (https://github.com/SorkinType/SplineSansMono)

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file added fonts/spline-sans-mono-latin.woff2
Binary file not shown.
Loading
Loading