Last active
September 13, 2024 16:34
-
-
Save peterhellberg/e5d32c58c78e6b1c4ed0e93a25b2cb7a to your computer and use it in GitHub Desktop.
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
const std = @import("std"); | |
pub fn build(b: *std.Build) void { | |
const target = b.resolveTargetQuery(.{ | |
.cpu_arch = .wasm32, | |
.os_tag = .freestanding, | |
}); | |
addPlugin(b, target, "zig", "zig.zig"); | |
} | |
fn addPlugin( | |
b: *std.Build, | |
target: std.Build.ResolvedTarget, | |
name: []const u8, | |
sub_path: []const u8, | |
) void { | |
const exe = b.addExecutable(.{ | |
.name = name, | |
.root_source_file = b.path(sub_path), | |
.strip = true, | |
.target = target, | |
.optimize = .ReleaseSmall, | |
}); | |
const typ = b.dependency("typ", .{}).module("typ"); | |
exe.root_module.addImport("typ", typ); | |
exe.entry = .disabled; | |
exe.rdynamic = true; | |
b.installArtifact(exe); | |
} |
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
.{ | |
.name = "plugins", | |
.version = "0.0.0", | |
.dependencies = .{ | |
.typ = .{ | |
.url = "https://github.com/peterhellberg/typ/archive/refs/tags/v0.0.9.tar.gz", | |
.hash = "1220fe63d37441757e3b597d9f5de728239a264646f3499a5b7c954485641b16f343", | |
}, | |
}, | |
.paths = .{ | |
"build.zig", | |
"build.zig.zon", | |
"zig.zig", | |
}, | |
} |
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
#set page( | |
width: 32cm, | |
height: 16cm, | |
fill: gradient.linear( | |
white, | |
gray, | |
angle: 90deg, | |
), | |
) | |
#set text(font: "Yanone Kaffeesatz", size: 2.7em) | |
#let zig = plugin("bin/zig.wasm") | |
= #heading( | |
stack( | |
dir: ltr, | |
[Hello, from], | |
h(10pt), | |
box( | |
width: 141pt, | |
image.decode(zig.logo_dark(), | |
format: "svg", | |
fit: "contain", | |
) | |
) | |
) | |
) | |
#let svg( | |
data, | |
fill: gradient.linear(gray, white, angle: 60deg), | |
inset: 8pt, | |
radius: 4pt, | |
width: 145pt, | |
height: auto, | |
alt: none, | |
) = { | |
block( | |
fill: fill, | |
inset: inset, | |
radius: radius, | |
width: width, | |
height: height, | |
image.decode(data, | |
format: "svg", | |
width: 100%, | |
fit: "contain", | |
) | |
) | |
} | |
#grid(columns: 5, gutter: 0.5em, | |
svg(zig.logo_dark(), height: 1.8em, fill:white), | |
svg(zig.logo_neg_black(), height: 1.8em, fill: white), | |
svg(zig.logo_dynamic(), height: 1.8em, fill: white), | |
svg(zig.logo_light(), height: 1.8em, fill: black), | |
svg(zig.logo_neg_white(), height: 1.8em, fill: black), | |
stack( | |
svg(zig.mark(), fill: none, height: 1.1em, inset: 0pt), | |
svg(zig.mark_neg_black(), fill: none, height: 1.1em, inset: 0pt), | |
svg(zig.mark_neg_white(), fill: none, height: 1.1em, inset: 0pt), | |
), | |
svg(zig.ziggy(), fill: none, height: 4em), | |
svg(zig.zero(), fill: none, height: 4em), | |
svg(zig.carmen(), fill: none, height: 4em), | |
[], | |
) |
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
const typ = @import("typ"); | |
export fn logo_dark() i32 { | |
return typ.ok(@embedFile("logos/zig-logo-dark.svg")); | |
} | |
export fn logo_dynamic() i32 { | |
return typ.ok(@embedFile("logos/zig-logo-dynamic.svg")); | |
} | |
export fn logo_light() i32 { | |
return typ.ok(@embedFile("logos/zig-logo-light.svg")); | |
} | |
export fn logo_neg_black() i32 { | |
return typ.ok(@embedFile("logos/zig-logo-neg-black.svg")); | |
} | |
export fn logo_neg_white() i32 { | |
return typ.ok(@embedFile("logos/zig-logo-neg-white.svg")); | |
} | |
export fn mark_neg_black() i32 { | |
return typ.ok(@embedFile("logos/zig-mark-neg-black.svg")); | |
} | |
export fn mark_neg_white() i32 { | |
return typ.ok(@embedFile("logos/zig-mark-neg-white.svg")); | |
} | |
export fn mark() i32 { | |
return typ.ok(@embedFile("logos/zig-mark.svg")); | |
} | |
export fn carmen() i32 { | |
return typ.ok(@embedFile("logos/carmen.svg")); | |
} | |
export fn zero() i32 { | |
return typ.ok(@embedFile("logos/zero.svg")); | |
} | |
export fn ziggy() i32 { | |
return typ.ok(@embedFile("logos/ziggy.svg")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/ziglang/logo