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

@ -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 {
var len = cbor.decodeMapHeader(iter) catch unreachable;
var len = cbor.decodeMapHeader(iter) catch return null;
while (len > 0) : (len -= 1) {
var field_name: []const u8 = undefined;
var value: []const u8 = undefined;
if (!(cbor.matchString(iter, &field_name) catch unreachable)) unreachable;
if (!(cbor.matchString(iter, &value) catch unreachable)) unreachable;
if (eql(u8, field_name, name))
return parse_color_value(value);
// 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;
// Try to match the value as string
if (cbor.matchString(iter, &value) catch false) {
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;
}

View file

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