DVUI

color

Get a color from this Options or fallback to theme colors.

Only valid between Window.beginand Window.end.

Parameters

#
self:*const Options
*const Options
ask:ColorAsk
ColorAsk

Source

Implementation

#
pub fn color(self: *const Options, ask: ColorAsk) Color {
    return switch (ask) {
        .border => self.color_border,
        .fill => self.color_fill,
        .fill_hover => self.color_fill_hover orelse if (self.color_fill) |col| self.themeGet().adjustColorForState(col, ask) else null,
        .fill_press => self.color_fill_press orelse if (self.color_fill) |col| self.themeGet().adjustColorForState(col, ask) else null,
        .text => self.color_text,
        .text_hover => self.color_text_hover orelse self.color_text,
        .text_press => self.color_text_press orelse self.color_text,
    } orelse self.themeGet().color(self.styleGet(), ask);
}