Repository navigation
logo: add openapi piece (fixes #35) #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bluzername
wants to merge
5
commits into
bas3line:main
Choose a base branch
from
bluzername:add-openapi-logo
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
61ed9d2
feat: add openapi piece, the OpenAPI gauge logo
bluzername d1f7b90
fix: openapi logo row count so the bottom is not cut off
bluzername 9f925ec
fix: rebase the openapi logo onto the pieces main added since
bluzername 7a42e88
fix: merge main's new pieces so the openapi logo stops conflicting
bluzername db03486
Merge remote-tracking branch 'upstream/main' into add-openapi-logo
bluzername File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,167 @@ | ||
| /* | ||
| * openapi: the OpenAPI Initiative's gauge mark, a green segmented dial with a | ||
| * dark pointer, with a glint crossing it every few seconds. | ||
| * | ||
| * Drawn by sampling the OpenAPI Initiative's own published mark (its GitHub | ||
| * avatar, openapis.org) onto a grid: each cell takes the shade of its ink | ||
| * coverage and the nearest of 4 sampled colours. On a canvas it takes the | ||
| * logo's colours, with the dark pointer lifted on a dark page where it would | ||
| * sink into it; in a <pre> it is one ink, from the same sampling. The mark is | ||
| * a trademark of its owner, shown here to name the specification. | ||
| */ | ||
| import type { Frame, Meta } from "../types.ts"; | ||
|
|
||
| export interface OpenapiOptions { | ||
| [key: string]: unknown; | ||
| /** Seconds between glints; 0 keeps the logo still. */ | ||
| shine: number; | ||
| } | ||
|
|
||
| export const meta = { | ||
| name: "openapi", | ||
| category: "logos", | ||
| note: "the openapi gauge: a green dial and dark pointer, glinting now and then", | ||
| cols: 46, | ||
| rows: 25, | ||
| fps: 30, | ||
| options: { shine: 5 }, | ||
| // The logo's 4 colours for a light page, then for a dark one; each as drawn, then twice lighter for the glint. | ||
| palette: [ | ||
| "#485828", "#68a030", "#404040", "#90d008", | ||
| "#92b154", "#9dd268", "#838383", "#bff847", | ||
| "#cddbb0", "#d2eab9", "#c6c6c6", "#e2fcaa", | ||
| "#485828", "#68a030", "#a9a9a9", "#90d008", | ||
| "#92b154", "#9dd268", "#c7c7c7", "#bff847", | ||
| "#cddbb0", "#d2eab9", "#e5e5e5", "#e2fcaa", | ||
| ], | ||
| } satisfies Meta<OpenapiOptions>; | ||
|
|
||
| // In a <pre>, in the page's own colour. | ||
| const MONO = String.raw` | ||
|
|
||
| -*%@@@#= | ||
| *@@@@@@@@%- | ||
| .:::.:::. =@@@@@@@@@@% | ||
| -+*%@@@@@+@@@@@%*=: =@@@@@@@@@@% | ||
| ==*@@@@@@@@@+@@@@@@@@@@= +@@@@@@@@@%: | ||
| -%@@**@@@@@@@@+@@@@@@@@#- +@@@@**#%#+- | ||
| +@@**%@#+@@@@@@@+@@@@@@#- +@@@@*: | ||
| .#@@@@@**%%=%@@@@@+@@@@#- +@@@@*::** | ||
| .%@@@@@@@@**%=%@@%%=%@#- +@@@@*::*@@@* | ||
| #@@@@@@@@@@@**-- +@@@@*::*@@@@@@* | ||
| =@@@@@@@@@@@@# -*%@@@#@@@@*::*@@@@@@@@@: | ||
| #@@@@@@@@@@@# +@@@@@@@@@%: *@@@@@@@@@@@+ | ||
| %%%%%%%%%%%%- :@@@@@@@@@@@ -***********= | ||
| *###########- :@@@@@@@@@@% *@@@@@@@@@@@# | ||
| *@@@@@@@@@@@# -@@@@@@@@%: -@@@@@@@@@@@@= | ||
| -@@@@@@@@#**#%- -+*#*+- =@@@@@@@@@@@@@ | ||
| *@@@%***%@@%**%--:...:=+=**@@@@@@@@@@@= | ||
| ****@@@@%**@@#+@@@@@@@@%=%**@@@@@@@@+ | ||
| +@@@@%**@@@%=@@@@@@@@@@@+%@**@@@@@- | ||
| :#%**@@@@@=@@@@@@@@@@@@@+#@@**@*. | ||
| .#@@@@@=%@@@@@@@@@@@@@@**@@* | ||
| .+#@+#@@@@@@@@@@@@@@@@+- | ||
| .=+#%@@@@@@%%*+=: | ||
|
|
||
| `; | ||
|
|
||
| // On a canvas, and the colour of each cell: an index into the logo's colours. | ||
| const ART = String.raw` | ||
|
|
||
| -*%@@@#= | ||
| *@@@@@@@@%- | ||
| .:::.:::. =@@@@@@@@@@% | ||
| -+*%@@@@@+@@@@@%*=: =@@@@@@@@@@% | ||
| ==*@@@@@@@@@+@@@@@@@@@@= +@@@@@@@@@%: | ||
| -%@@**@@@@@@@@+@@@@@@@@#- +@@@@**#%#+- | ||
| +@@**%@#+@@@@@@@+@@@@@@#- +@@@@*: | ||
| .#@@@@@**%%=%@@@@@+@@@@#- +@@@@*::** | ||
| .%@@@@@@@@**%=%@@%%=%@#- +@@@@*::*@@@* | ||
| #@@@@@@@@@@@**-- +@@@@*::*@@@@@@* | ||
| =@@@@@@@@@@@@# -*%@@@#@@@@*::*@@@@@@@@@: | ||
| #@@@@@@@@@@@# +@@@@@@@@@%: *@@@@@@@@@@@+ | ||
| %%%%%%%%%%%%- :@@@@@@@@@@@ -***********= | ||
| *###########- :@@@@@@@@@@% *@@@@@@@@@@@# | ||
| *@@@@@@@@@@@# -@@@@@@@@%: -@@@@@@@@@@@@= | ||
| -@@@@@@@@#**#%- -+*#*+- =@@@@@@@@@@@@@ | ||
| *@@@%***%@@%**%--:...:=+=**@@@@@@@@@@@= | ||
| ****@@@@%**@@#+@@@@@@@@%=%**@@@@@@@@+ | ||
| +@@@@%**@@@%=@@@@@@@@@@@+%@**@@@@@- | ||
| :#%**@@@@@=@@@@@@@@@@@@@+#@@**@*. | ||
| .#@@@@@=%@@@@@@@@@@@@@@**@@* | ||
| .+#@+#@@@@@@@@@@@@@@@@+- | ||
| .=+#%@@@@@@%%*+=: | ||
|
|
||
| `; | ||
| const INK = String.raw` | ||
|
|
||
| 22222222 | ||
| 22222222221 | ||
| 111110001 122222222222 | ||
| 1111111111000000000 122222222222 | ||
| 331111111111100000000000 222222222221 | ||
| 3333311111111110000000000 222222222222 | ||
| 0000333311111111100000000 2222221 | ||
| 1000000033311111111000000 2222221000 | ||
| 100000000003331111110000 2222221000000 | ||
| 0000000000000331 2222221000000000 | ||
| 00000000000000 2222222222221000000000001 | ||
| 0000000000000 222222222221 0000000000000 | ||
| 0000000000001 222222222222 0000000000001 | ||
| 3333333333333 122222222222 1111111111111 | ||
| 3333333333333 22222222221 11111111111111 | ||
| 333333333331111 2222222 11111111111111 | ||
| 333333311111100033333333101111111111111 | ||
| 3311111111000033333333333001111111111 | ||
| 11111110000033333333333330001111111 | ||
| 111100000033333333333333300001111 | ||
| 1000000033333333333333330000 | ||
| 100003333333333333333331 | ||
| 33333333333333333 | ||
|
|
||
| `; | ||
|
|
||
| const START = 0.5; // seconds before the first glint | ||
| const PASS = 2; // seconds a glint takes to cross | ||
| const HALF = 5; // half its width, in cells | ||
| const LEAN = 0.9; // cells it shifts left a row down, so it leans like a slash | ||
| const SOLID = "8dbqpPYOo0@#%*+=:.-"; // what the glint turns to slashes; thin edges keep their shape | ||
|
|
||
| const lines = (art: string) => art.slice(1, -1).split("\n").map((line) => line.padEnd(meta.cols)); | ||
|
|
||
| export default function openapi({ shine = meta.options.shine }: Partial<OpenapiOptions> = {}): Frame { | ||
| const { cols, rows } = meta; | ||
| const mono = lines(MONO), art = lines(ART), ink = lines(INK); | ||
| const n = meta.palette.length / 6; | ||
| const every = shine > 0 ? Math.max(shine, PASS + 0.5) : 0; | ||
| // The glint crosses the logo's ink, edge to edge, rather than the whole frame. | ||
| let lo = Infinity, hi = -Infinity; | ||
| for (const pic of [mono, art]) | ||
| pic.forEach((line, y) => { | ||
| for (let x = 0; x < cols; x++) if (line[x] !== " ") (lo = Math.min(lo, x + LEAN * y)), (hi = Math.max(hi, x + LEAN * y)); | ||
| }); | ||
| const span = hi - lo + 2 * HALF; | ||
|
|
||
| return (t, { paper = false, color } = {}) => { | ||
| const pic = color ? art : mono; | ||
| const since = t - START; | ||
| const at = every && since >= 0 ? lo - HALF + (span * (since % every)) / PASS : -Infinity; | ||
| const out: string[] = []; | ||
| for (let y = 0; y < rows; y++) { | ||
| let line = ""; | ||
| for (let x = 0; x < cols; x++) { | ||
| let ch = pic[y][x]; | ||
| if (ch !== " ") { | ||
| const d = Math.abs(x + LEAN * y - at); | ||
| let k = d < HALF ? 1 - d / HALF : 0; | ||
| k = k * k * (3 - 2 * k); | ||
| if (k > 0.55 && SOLID.includes(ch)) ch = "/"; | ||
| if (color) color[y * cols + x] = (paper ? 0 : 3 * n) + (k > 0.6 ? 2 : k > 0.25 ? 1 : 0) * n + parseInt(ink[y][x], 36); | ||
| } | ||
| line += ch; | ||
| } | ||
| out.push(line); | ||
| } | ||
| return out.join("\n"); | ||
| }; | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding
openapiwithout updatingskills/makes CI fail.npm run genalso rebuilds the skill catalog and its piece count, but the committed catalog still skips fromocamltoperl. CI runs the generator and rejects any changes inskills/.Run
npm run genon this branch and commit all generated files.Prompt To Fix With AI