add Zenbones dark theme and fix some build issues

This commit is contained in:
plyght 2025-02-03 14:59:25 -05:00 committed by CJ van den Berg
parent 8b79cf6d79
commit 82b64b6a7f
4 changed files with 31 additions and 8 deletions

View file

@ -84,4 +84,5 @@ fn add_themes(b: *std.Build, exe: anytype) void {
theme_file(b, exe, "catppuccin", "themes/macchiato.json"); theme_file(b, exe, "catppuccin", "themes/macchiato.json");
theme_file(b, exe, "catppuccin", "themes/mocha.json"); theme_file(b, exe, "catppuccin", "themes/mocha.json");
theme_file(b, exe, "mellow", "themes/mellow.json"); theme_file(b, exe, "mellow", "themes/mellow.json");
theme_file(b, exe, "zenbones", "extras/vscode/themes/zenbones_dark_default.json");
} }

View file

@ -72,10 +72,15 @@
.theme_mellow = .{ .theme_mellow = .{
.url = "https://github.com/mellow-theme/mellow-theme/archive/00cea86c91a8eb95af09b2cb587a30d52e06ba91.tar.gz", .url = "https://github.com/mellow-theme/mellow-theme/archive/00cea86c91a8eb95af09b2cb587a30d52e06ba91.tar.gz",
.hash = "122062276c850b37d78f4f981c25c1b14f05d1124429b6e496fe059107c9115d00da", .hash = "122062276c850b37d78f4f981c25c1b14f05d1124429b6e496fe059107c9115d00da",
} },
.theme_zenbones = .{
.url = "https://github.com/rpbritton/zenbones.vscode/archive/97c071875576078395a9dc026ec71a5ff8db68ab.tar.gz",
.hash = "12205871af8254b098b844d684e13eebe038aca0671f18e051ffeadf350c761d6e18"
},
}, },
.paths = .{ .paths = .{
"build.zig", "build.zig",
"build.zig.zon", "build.zig.zon",
}, },
} }

View file

@ -313,14 +313,30 @@ fn find_color(name: []const u8, cb: []const u8) ?Color {
} }
fn find_in_colors(name: []const u8, iter: *[]const u8) ?Color { fn find_in_colors(name: []const u8, iter: *[]const u8) ?Color {
var len = cbor.decodeMapHeader(iter) catch unreachable; var len = cbor.decodeMapHeader(iter) catch return null;
while (len > 0) : (len -= 1) { while (len > 0) : (len -= 1) {
var field_name: []const u8 = undefined; var field_name: []const u8 = undefined;
// Try to match field name, skip if not a string
if (cbor.matchString(iter, &field_name) catch false) {
// If we find the field we're looking for
if (eql(u8, field_name, name)) {
var value: []const u8 = undefined; var value: []const u8 = undefined;
if (!(cbor.matchString(iter, &field_name) catch unreachable)) unreachable; // Try to match the value as string
if (!(cbor.matchString(iter, &value) catch unreachable)) unreachable; if (cbor.matchString(iter, &value) catch false) {
if (eql(u8, field_name, name))
return parse_color_value(value); return parse_color_value(value);
} else {
// Skip non-string value
cbor.skipValue(iter) catch return null;
}
} else {
// Skip value for non-matching field
cbor.skipValue(iter) catch return null;
}
} else {
// Skip both non-string field name and its value
cbor.skipValue(iter) catch return null;
cbor.skipValue(iter) catch return null;
}
} }
return null; return null;
} }

View file

@ -46,6 +46,7 @@ pub const theme_files = [_]theme_file{
THEME("themes/macchiato.json"), THEME("themes/macchiato.json"),
THEME("themes/mocha.json"), THEME("themes/mocha.json"),
THEME("themes/mellow.json"), THEME("themes/mellow.json"),
THEME("extras/vscode/themes/zenbones_dark_default.json"),
// light themes // light themes