diff --git a/.github/workflows/kit.yml b/.github/workflows/kit.yml new file mode 100644 index 0000000..8d704fe --- /dev/null +++ b/.github/workflows/kit.yml @@ -0,0 +1,42 @@ +name: kit + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + # The whole format matrix, not a sample: see check/kit.py. + complete: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - run: python3 check/kit.py + + # svg/color/go-scikit.svg is what mark/main.go writes: the stack of member + # organisations, laid out by the program, not drawn. This writes it again and fails if a + # byte differs, so the mark cannot drift from the program that defines it. + # (The PNG, JPG, ICO, ICNS, avatar and social files are rendered from that + # SVG by logos/brandgen; check/kit.py above counts them.) + mark: + name: the mark is what its program writes + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 + with: + go-version-file: mark/go.mod + cache: false + - name: Write the mark + working-directory: mark + run: go run . > ../svg/color/go-scikit.svg + - name: The committed mark is the one written + run: | + if ! git diff --exit-code --stat -- svg/color/go-scikit.svg; then + echo "::error::svg/color/go-scikit.svg differs from what mark/main.go writes: run 'cd mark && go run . > ../svg/color/go-scikit.svg', then regenerate the kit with logos/brandgen" + exit 1 + fi diff --git a/README.md b/README.md index 0d4dcd7..0101a78 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,43 @@ -# brand -Logo, icons and social images of go-scikit +# go-scikit — brand assets + +Official logos for the **go-scikit** organization, the umbrella over the +fleet's scientific Go work. + +go-scikit + +The mark is the stack drawn as a building. The base is the arrays, one plate +cut in two: go-ndarray and go-fft. On it stand four columns, one for each +library that computes on those arrays: go-numerics, go-statistics, +go-dataframe and go-plot. They carry the beam, go-notebook, where all of them +meet. Nothing is placed by hand: `mark/main.go` lists the member organisations +layer by layer, and the plates, cells, columns and spacing follow from that +list. + +Its gradient (`#8FA3C8` to `#2F3E63`) is a slate blue that sets the umbrella +apart from every member: the emerald of go-ndarray, go-fft and go-notebook, +go-numerics' violet, go-statistics' amber, go-dataframe's magenta and +go-plot's blue. Its dark end reads on white at 10.55:1 and its light end on a +dark page at 7.58:1. + +## Formats + +- **SVG** — `svg/color`, `svg/white` (white, transparent), `svg/black` (black, transparent) +- **PNG** 16→1024 px, 3 variants — `png///` +- **JPG** (color, white background) — `jpg//` +- **ICO** (Windows) — `ico/` +- **ICNS** (macOS) — `icns/` +- **GitHub avatar** 512 px — `avatar/` +- **Social preview** 1280×640 (repo banner) — `social/` + +`check/kit.py` counts the whole matrix on every pull request, and the `mark` +job writes `svg/color/go-scikit.svg` again from `mark/main.go` and fails if +a byte differs. + +```sh +cd mark && go run . > ../svg/color/go-scikit.svg +``` + +--- +*`svg/color/go-scikit.svg` is written by `mark/main.go`; every other file is +generated from it by the fleet's Go brand pipeline (brandgen) — rounded square +badge, line glyph, color / white / black variants.* diff --git a/avatar/go-scikit.png b/avatar/go-scikit.png new file mode 100644 index 0000000..c475647 Binary files /dev/null and b/avatar/go-scikit.png differ diff --git a/check/kit.py b/check/kit.py new file mode 100644 index 0000000..1e034ac --- /dev/null +++ b/check/kit.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python3 +"""Check that the brand kit is complete and well formed. + +Every format the README promises must be there, at every size, and each file +must be what its path says: a PNG or JPG of that size, an ICO or ICNS by its +magic number, a 512-px avatar, a 1280x640 social preview. The white and black +SVG variants must carry no other colour. A kit once lived for a week with +three of its seven formats because every existing check looked at something +that was present; this counts the whole matrix instead. +""" +import os +import re +import struct +import sys + +ORG = "go-scikit" +SIZES = [16, 32, 48, 64, 128, 256, 512, 1024] +errors = [] + + +def need(path): + if not os.path.isfile(path): + errors.append(f"missing: {path}") + return None + with open(path, "rb") as f: + return f.read() + + +def png_size(b): + if b[:8] != b"\x89PNG\r\n\x1a\n": + return None + return struct.unpack(">II", b[16:24]) + + +def jpg_size(b): + if b[:2] != b"\xff\xd8": + return None + i = 2 + while i < len(b) - 9: + if b[i] != 0xFF: + i += 1 + continue + marker = b[i + 1] + if marker in (0xC0, 0xC1, 0xC2): + h, w = struct.unpack(">HH", b[i + 5:i + 9]) + return (w, h) + i += 2 + struct.unpack(">H", b[i + 2:i + 4])[0] + return None + + +def expect_size(path, got, want): + if got is None: + errors.append(f"not a valid image: {path}") + elif tuple(got) != tuple(want): + errors.append(f"{path}: {got[0]}x{got[1]}, want {want[0]}x{want[1]}") + + +for variant in ("color", "white", "black"): + svg = need(f"svg/{variant}/{ORG}.svg") + if svg is not None and variant != "color": + mono = "#FFFFFF" if variant == "white" else "#000000" + others = {c.upper() for c in re.findall(rb"#[0-9A-Fa-f]{6}", svg)} - {mono.encode()} + if others: + errors.append(f"svg/{variant}/{ORG}.svg carries other colours: {sorted(others)}") + for s in SIZES: + b = need(f"png/{variant}/{s}/{ORG}.png") + if b is not None: + expect_size(f"png/{variant}/{s}/{ORG}.png", png_size(b), (s, s)) +for s in SIZES: + b = need(f"jpg/{s}/{ORG}.jpg") + if b is not None: + expect_size(f"jpg/{s}/{ORG}.jpg", jpg_size(b), (s, s)) +b = need(f"avatar/{ORG}.png") +if b is not None: + expect_size(f"avatar/{ORG}.png", png_size(b), (512, 512)) +b = need(f"social/{ORG}.png") +if b is not None: + expect_size(f"social/{ORG}.png", png_size(b), (1280, 640)) +b = need(f"ico/{ORG}.ico") +if b is not None and b[:4] != b"\x00\x00\x01\x00": + errors.append(f"ico/{ORG}.ico is not an ICO file") +b = need(f"icns/{ORG}.icns") +if b is not None and b[:4] != b"icns": + errors.append(f"icns/{ORG}.icns is not an ICNS file") + +if errors: + print("\n".join(errors)) + sys.exit(1) +print(f"brand kit complete: 3 SVG, {3 * len(SIZES)} PNG, {len(SIZES)} JPG, avatar, social, ICO, ICNS") diff --git a/icns/go-scikit.icns b/icns/go-scikit.icns new file mode 100644 index 0000000..3897a66 Binary files /dev/null and b/icns/go-scikit.icns differ diff --git a/ico/go-scikit.ico b/ico/go-scikit.ico new file mode 100644 index 0000000..ab60808 Binary files /dev/null and b/ico/go-scikit.ico differ diff --git a/jpg/1024/go-scikit.jpg b/jpg/1024/go-scikit.jpg new file mode 100644 index 0000000..f452fe6 Binary files /dev/null and b/jpg/1024/go-scikit.jpg differ diff --git a/jpg/128/go-scikit.jpg b/jpg/128/go-scikit.jpg new file mode 100644 index 0000000..5bc47f6 Binary files /dev/null and b/jpg/128/go-scikit.jpg differ diff --git a/jpg/16/go-scikit.jpg b/jpg/16/go-scikit.jpg new file mode 100644 index 0000000..2dd2369 Binary files /dev/null and b/jpg/16/go-scikit.jpg differ diff --git a/jpg/256/go-scikit.jpg b/jpg/256/go-scikit.jpg new file mode 100644 index 0000000..8478c96 Binary files /dev/null and b/jpg/256/go-scikit.jpg differ diff --git a/jpg/32/go-scikit.jpg b/jpg/32/go-scikit.jpg new file mode 100644 index 0000000..70d56c6 Binary files /dev/null and b/jpg/32/go-scikit.jpg differ diff --git a/jpg/48/go-scikit.jpg b/jpg/48/go-scikit.jpg new file mode 100644 index 0000000..9cdfdd5 Binary files /dev/null and b/jpg/48/go-scikit.jpg differ diff --git a/jpg/512/go-scikit.jpg b/jpg/512/go-scikit.jpg new file mode 100644 index 0000000..29e2e79 Binary files /dev/null and b/jpg/512/go-scikit.jpg differ diff --git a/jpg/64/go-scikit.jpg b/jpg/64/go-scikit.jpg new file mode 100644 index 0000000..4de6f03 Binary files /dev/null and b/jpg/64/go-scikit.jpg differ diff --git a/mark/go.mod b/mark/go.mod new file mode 100644 index 0000000..eaa79b6 --- /dev/null +++ b/mark/go.mod @@ -0,0 +1,3 @@ +module github.com/go-scikit/brand/mark + +go 1.27.2 diff --git a/mark/main.go b/mark/main.go new file mode 100644 index 0000000..9fdfadf --- /dev/null +++ b/mark/main.go @@ -0,0 +1,117 @@ +// Command mark writes the go-scikit mark, svg/color/go-scikit.svg: +// +// cd mark && go run . > ../svg/color/go-scikit.svg +// +// go-scikit is the umbrella over seven organisations, and the mark is their +// stack drawn as a building: a base, the columns standing on it, and the +// beam they carry. +// +// - the base is the arrays: go-ndarray and go-fft, one plate cut in two; +// - the columns are the libraries that compute on those arrays: +// go-numerics, go-statistics, go-dataframe and go-plot, one column each; +// - the beam is go-notebook, the one place where all of them meet. +// +// Nothing is placed by hand. The layers below list the member organisations, +// and the geometry follows from them: a plate is cut into as many cells as its +// layer has members, the columns are spaced evenly across the width, and the +// vertical spacing leaves the same clear gap between the strokes of every two +// layers. Add a member to a layer and the mark redraws itself. +// +// The rest is the family grammar every go-* mark shares: a 256-unit rounded +// square (rx 56) filled with a diagonal two-stop gradient, a white line glyph +// at stroke-width 13 with round caps and joins. logos/brandgen renders the +// format matrix from the file this writes; the kit workflow runs this again +// and fails if a byte of svg/color differs. +package main + +import ( + "fmt" + "math" + "os" + "strings" +) + +const ( + light = "#8FA3C8" // the gradient's light stop + dark = "#2F3E63" // its dark stop + + stroke = 13.0 // the family's line width + + left, right = 48.0, 208.0 // the glyph's horizontal extent (stroke centres) + plate = 30.0 // height of a plate, between stroke centres + gap = 12.0 // clear space between the strokes of two layers + radius = 8.0 // corner radius of a plate +) + +// layer is one level of the stack, bottom first. +type layer struct { + members []string + columns bool // drawn as columns rather than as a plate +} + +var stack = []layer{ + {members: []string{"go-ndarray", "go-fft"}}, + {members: []string{"go-numerics", "go-statistics", "go-dataframe", "go-plot"}, columns: true}, + {members: []string{"go-notebook"}}, +} + +// num prints a coordinate with at most one decimal and no trailing zero. +func num(v float64) string { + s := fmt.Sprintf("%.1f", math.Round(v*10)/10) + s = strings.TrimSuffix(s, ".0") + if s == "-0" { + s = "0" + } + return s +} + +func main() { + // A column is half as tall again as a plate. The layers, strokes + // included, are centred on the square. + column := 1.5 * plate + total := 0.0 + for _, l := range stack { + if l.columns { + total += column + } else { + total += plate + } + } + total += float64(len(stack)-1) * (gap + stroke) + + var paths []string + // Bottom layer first: y grows downwards, so start at the bottom edge. + y := 128 + total/2 + for _, l := range stack { + n := float64(len(l.members)) + if l.columns { + // A line's round caps reach stroke/2 past its ends, exactly as a + // plate's stroke reaches stroke/2 past its edge, so the same + // spacing leaves the same clear gap. + top, bottom := y-column, y + for i := range l.members { + x := left + (right-left)*(float64(i)+0.5)/n + paths = append(paths, fmt.Sprintf(``, num(x), num(top), num(bottom))) + } + y -= column + gap + stroke + continue + } + top := y - plate + paths = append(paths, fmt.Sprintf(``, + num(left), num(top), num(right-left), num(plate), num(radius))) + for i := 1; i < len(l.members); i++ { + x := left + (right-left)*float64(i)/n + paths = append(paths, fmt.Sprintf(``, num(x), num(top), num(y))) + } + y -= plate + gap + stroke + } + + fmt.Fprintf(os.Stdout, ` + + + + %s + + +`, light, dark, num(stroke), strings.Join(paths, "\n ")) +} diff --git a/png/black/1024/go-scikit.png b/png/black/1024/go-scikit.png new file mode 100644 index 0000000..75730f3 Binary files /dev/null and b/png/black/1024/go-scikit.png differ diff --git a/png/black/128/go-scikit.png b/png/black/128/go-scikit.png new file mode 100644 index 0000000..fa6f214 Binary files /dev/null and b/png/black/128/go-scikit.png differ diff --git a/png/black/16/go-scikit.png b/png/black/16/go-scikit.png new file mode 100644 index 0000000..aa037f9 Binary files /dev/null and b/png/black/16/go-scikit.png differ diff --git a/png/black/256/go-scikit.png b/png/black/256/go-scikit.png new file mode 100644 index 0000000..8f93f85 Binary files /dev/null and b/png/black/256/go-scikit.png differ diff --git a/png/black/32/go-scikit.png b/png/black/32/go-scikit.png new file mode 100644 index 0000000..02ebfb4 Binary files /dev/null and b/png/black/32/go-scikit.png differ diff --git a/png/black/48/go-scikit.png b/png/black/48/go-scikit.png new file mode 100644 index 0000000..d8a2c63 Binary files /dev/null and b/png/black/48/go-scikit.png differ diff --git a/png/black/512/go-scikit.png b/png/black/512/go-scikit.png new file mode 100644 index 0000000..5a80968 Binary files /dev/null and b/png/black/512/go-scikit.png differ diff --git a/png/black/64/go-scikit.png b/png/black/64/go-scikit.png new file mode 100644 index 0000000..1fead4f Binary files /dev/null and b/png/black/64/go-scikit.png differ diff --git a/png/color/1024/go-scikit.png b/png/color/1024/go-scikit.png new file mode 100644 index 0000000..9e947d0 Binary files /dev/null and b/png/color/1024/go-scikit.png differ diff --git a/png/color/128/go-scikit.png b/png/color/128/go-scikit.png new file mode 100644 index 0000000..03d79ca Binary files /dev/null and b/png/color/128/go-scikit.png differ diff --git a/png/color/16/go-scikit.png b/png/color/16/go-scikit.png new file mode 100644 index 0000000..dcfb972 Binary files /dev/null and b/png/color/16/go-scikit.png differ diff --git a/png/color/256/go-scikit.png b/png/color/256/go-scikit.png new file mode 100644 index 0000000..5be655b Binary files /dev/null and b/png/color/256/go-scikit.png differ diff --git a/png/color/32/go-scikit.png b/png/color/32/go-scikit.png new file mode 100644 index 0000000..a07a7ac Binary files /dev/null and b/png/color/32/go-scikit.png differ diff --git a/png/color/48/go-scikit.png b/png/color/48/go-scikit.png new file mode 100644 index 0000000..62a13de Binary files /dev/null and b/png/color/48/go-scikit.png differ diff --git a/png/color/512/go-scikit.png b/png/color/512/go-scikit.png new file mode 100644 index 0000000..c475647 Binary files /dev/null and b/png/color/512/go-scikit.png differ diff --git a/png/color/64/go-scikit.png b/png/color/64/go-scikit.png new file mode 100644 index 0000000..6b235f1 Binary files /dev/null and b/png/color/64/go-scikit.png differ diff --git a/png/white/1024/go-scikit.png b/png/white/1024/go-scikit.png new file mode 100644 index 0000000..14b62a5 Binary files /dev/null and b/png/white/1024/go-scikit.png differ diff --git a/png/white/128/go-scikit.png b/png/white/128/go-scikit.png new file mode 100644 index 0000000..79d372d Binary files /dev/null and b/png/white/128/go-scikit.png differ diff --git a/png/white/16/go-scikit.png b/png/white/16/go-scikit.png new file mode 100644 index 0000000..e104a79 Binary files /dev/null and b/png/white/16/go-scikit.png differ diff --git a/png/white/256/go-scikit.png b/png/white/256/go-scikit.png new file mode 100644 index 0000000..1254019 Binary files /dev/null and b/png/white/256/go-scikit.png differ diff --git a/png/white/32/go-scikit.png b/png/white/32/go-scikit.png new file mode 100644 index 0000000..2c02911 Binary files /dev/null and b/png/white/32/go-scikit.png differ diff --git a/png/white/48/go-scikit.png b/png/white/48/go-scikit.png new file mode 100644 index 0000000..f200b9a Binary files /dev/null and b/png/white/48/go-scikit.png differ diff --git a/png/white/512/go-scikit.png b/png/white/512/go-scikit.png new file mode 100644 index 0000000..52aaf37 Binary files /dev/null and b/png/white/512/go-scikit.png differ diff --git a/png/white/64/go-scikit.png b/png/white/64/go-scikit.png new file mode 100644 index 0000000..95f4090 Binary files /dev/null and b/png/white/64/go-scikit.png differ diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..123150f --- /dev/null +++ b/renovate.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": ["github>go-scikit/.github"] +} diff --git a/social/go-scikit.png b/social/go-scikit.png new file mode 100644 index 0000000..dc68779 Binary files /dev/null and b/social/go-scikit.png differ diff --git a/svg/black/go-scikit.svg b/svg/black/go-scikit.svg new file mode 100644 index 0000000..1d9ad65 --- /dev/null +++ b/svg/black/go-scikit.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/svg/color/go-scikit.svg b/svg/color/go-scikit.svg new file mode 100644 index 0000000..bdbe7dc --- /dev/null +++ b/svg/color/go-scikit.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/svg/white/go-scikit.svg b/svg/white/go-scikit.svg new file mode 100644 index 0000000..f6ddc3e --- /dev/null +++ b/svg/white/go-scikit.svg @@ -0,0 +1,11 @@ + + + + + + + + + + +