Something went wrong. Try again.
Fork of dvui, the immediate-mode Zig GUI, with a font face index for Pipit
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190const dvui = @import("../dvui.zig");
const Color = dvui.Color;const Font = dvui.Font;const Theme = dvui.Theme;const Options = dvui.Options;
const accent = Color{ .r = 0x35, .g = 0x84, .b = 0xe4 };const accent_hsl = Color.HSLuv.fromColor(accent);const err = Color{ .r = 0xe0, .g = 0x1b, .b = 0x24 };const err_hsl = Color.HSLuv.fromColor(err);
// need to have these as separate variables because inlining them below trips// zig's comptime eval quotaconst light_accent_accent = accent_hsl.lighten(-16).color();const light_accent_fill = accent_hsl.color();const light_accent_fill_hover = accent_hsl.lighten(-11).color();const light_accent_border = accent_hsl.lighten(-22).color();
const light_err_accent = err_hsl.lighten(-15).color();const light_err_fill = err_hsl.color();const light_err_fill_hover = err_hsl.lighten(-10).color();const light_err_border = err_hsl.lighten(-20).color();
const fonts: []const Font.Source = &.{ .{ .family = Font.array("Vera Sans"), .bytes = @embedFile("../fonts/bitstream-vera/Vera.ttf"), }, .{ .family = Font.array("Vera Sans"), .weight = .bold, .bytes = @embedFile("../fonts/bitstream-vera/VeraBd.ttf"), }, .{ .family = Font.array("Vera Sans"), .style = .italic, .bytes = @embedFile("../fonts/bitstream-vera/VeraIt.ttf"), }, .{ .family = Font.array("Vera Sans"), .weight = .bold, .style = .italic, .bytes = @embedFile("../fonts/bitstream-vera/VeraBI.ttf"), }, .{ .family = Font.array("Vera Sans Mono"), .bytes = @embedFile("../fonts/bitstream-vera/VeraMono.ttf"), }, .{ .family = Font.array("Vera Sans Mono"), .weight = .bold, .bytes = @embedFile("../fonts/bitstream-vera/VeraMoBd.ttf"), }, .{ .family = Font.array("Vera Sans Mono"), .style = .italic, .bytes = @embedFile("../fonts/bitstream-vera/VeraMoIt.ttf"), }, .{ .family = Font.array("Vera Sans Mono"), .weight = .bold, .style = .italic, .bytes = @embedFile("../fonts/bitstream-vera/VeraMoBI.ttf"), }, .{ .family = Font.array("Vera Serif"), .bytes = @embedFile("../fonts/bitstream-vera/VeraSe.ttf"), }, .{ .family = Font.array("Vera Serif"), .weight = .bold, .bytes = @embedFile("../fonts/bitstream-vera/VeraSeBd.ttf"), },};
pub const light = light: { @setEvalBranchQuota(3123); break :light Theme{ .name = "Adwaita Light", .dark = false,
.embedded_fonts = fonts,
.font_body = .find(.{ .family = "Vera Sans" }), .font_heading = .find(.{ .family = "Vera Sans", .weight = .bold }), .font_title = .find(.{ .family = "Vera Sans", .size = dvui.Font.DefaultSize + 2 }), .font_mono = .find(.{ .family = "Vera Sans Mono" }),
.focus = accent,
.fill = Color.white, .fill_hover = (Color.HSLuv{ .s = 0, .l = 82 }).color(), .fill_press = (Color.HSLuv{ .s = 0, .l = 72 }).color(), .text = Color.black, .text_select = .{ .r = 0x91, .g = 0xbc, .b = 0xf0 }, .border = (Color.HSLuv{ .s = 0, .l = 63 }).color(),
.control = .{ .fill = .{ .r = 0xe0, .g = 0xe0, .b = 0xe0 }, .fill_hover = (Color.HSLuv{ .s = 0, .l = 82 }).color(), .fill_press = (Color.HSLuv{ .s = 0, .l = 72 }).color(), },
.window = .{ .fill = .{ .r = 0xf0, .g = 0xf0, .b = 0xf0 }, },
.highlight = .{ .fill = light_accent_fill, .fill_hover = light_accent_fill_hover, .fill_press = light_accent_accent, .text = Color.white, .border = light_accent_border, },
.err = .{ .fill = light_err_fill, .fill_hover = light_err_fill_hover, .fill_press = light_err_accent, .text = Color.white, .border = light_err_border, }, };};
const dark_fill = Color{ .r = 0x1e, .g = 0x1e, .b = 0x1e };const dark_fill_hsl = Color.HSLuv.fromColor(dark_fill);const dark_err = Color{ .r = 0xc0, .g = 0x1c, .b = 0x28 };const dark_err_hsl = Color.HSLuv.fromColor(dark_err);
const dark_accent_accent = accent_hsl.lighten(12).color();const dark_accent_fill_hover = accent_hsl.lighten(9).color();const dark_accent_border = accent_hsl.lighten(17).color();
const dark_err_accent = dark_err_hsl.lighten(14).color();const dark_err_fill_hover = err_hsl.lighten(9).color();const dark_err_fill_press = err_hsl.lighten(16).color();const dark_err_border = err_hsl.lighten(20).color();
pub const dark = dark: { @setEvalBranchQuota(3023); break :dark Theme{ .name = "Adwaita Dark", .dark = true,
.embedded_fonts = fonts,
.font_body = .find(.{ .family = "Vera Sans" }), .font_heading = .find(.{ .family = "Vera Sans", .weight = .bold }), .font_title = .find(.{ .family = "Vera Sans", .size = dvui.Font.DefaultSize + 2 }), .font_mono = .find(.{ .family = "Vera Sans Mono" }),
.focus = accent,
.fill = dark_fill, .fill_hover = dark_fill_hsl.lighten(21).color(), .fill_press = dark_fill_hsl.lighten(30).color(), .text = Color.white, .text_select = .{ .r = 0x32, .g = 0x60, .b = 0x98 }, .border = dark_fill_hsl.lighten(39).color(),
.control = .{ .fill = .{ .r = 0x40, .g = 0x40, .b = 0x40 }, .fill_hover = dark_fill_hsl.lighten(21).color(), .fill_press = dark_fill_hsl.lighten(30).color(), },
.window = .{ .fill = .{ .r = 0x2b, .g = 0x2b, .b = 0x2b }, },
.highlight = .{ .fill = accent, .fill_hover = dark_accent_fill_hover, .fill_press = dark_accent_accent, .text = Color.white, .border = dark_accent_border, },
.err = .{ .fill = dark_err, .fill_hover = dark_err_fill_hover, .fill_press = dark_err_fill_press, .text = Color.white, .border = dark_err_border, }, };};