-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
292 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,54 @@ | ||
import { SchemeTonalSpot, Hct } from "@material/material-color-utilities"; | ||
|
||
const sourceColors: number[] = []; | ||
for (let h = 0; h < 360; h += 30) { | ||
sourceColors.push(Hct.from(h, 50, 60).toInt()); | ||
} | ||
|
||
const schemeColors = ["primary", "secondary", "tertiary"] as const; | ||
|
||
const width = 1280; | ||
const height = 640; | ||
const dotSize = 16; | ||
const xSpacing = width / (sourceColors.length + 1); | ||
const ySpacing = height / (schemeColors.length + 1); | ||
|
||
let svg = `<svg width="${width}" height="${height}" xmlns="http://www.w3.org/2000/svg"> | ||
<defs> | ||
<style> | ||
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@700&display=swap'); | ||
</style> | ||
</defs> | ||
<rect width="100%" height="100%" fill="#1c1b1f"/> | ||
<g>`; | ||
|
||
sourceColors.forEach((sourceColor, x) => { | ||
const scheme = new SchemeTonalSpot(Hct.fromInt(sourceColor), true, 0); | ||
schemeColors.forEach((color, y) => { | ||
const colorValue = scheme[color]; | ||
svg += ` | ||
<circle | ||
cx="${(x + 1) * xSpacing}" | ||
cy="${(y + 1) * ySpacing}" | ||
r="${dotSize / 2}" | ||
fill="#${(colorValue >>> 0).toString(16).padStart(8, "0").slice(2)}" | ||
/>`; | ||
}); | ||
}); | ||
|
||
svg += ` | ||
</g> | ||
<text | ||
x="50%" | ||
y="50%" | ||
font-family="Roboto" | ||
font-size="120" | ||
font-weight="700" | ||
fill="white" | ||
text-anchor="middle" | ||
dominant-baseline="middle" | ||
>M3 Svelte</text> | ||
</svg>`; | ||
|
||
await Deno.writeTextFile("static/og.svg", svg); |
This file contains 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.