enumstd.zig.Color[src]

Fields

auto

Determine whether stderr is a terminal or not automatically.

off

Assume stderr is not a terminal.

on

Assume stderr is a terminal.

Functions

Functionget_tty_conf[src]

pub fn get_tty_conf(color: Color) std.io.tty.Config

Parameters

color: Color

Source Code

Source code
pub fn get_tty_conf(color: Color) std.io.tty.Config {
    return switch (color) {
        .auto => std.io.tty.detectConfig(std.io.getStdErr()),
        .on => .escape_codes,
        .off => .no_color,
    };
}

FunctionrenderOptions[src]

pub fn renderOptions(color: Color) std.zig.ErrorBundle.RenderOptions

Parameters

color: Color

Source Code

Source code
pub fn renderOptions(color: Color) std.zig.ErrorBundle.RenderOptions {
    return .{
        .ttyconf = get_tty_conf(color),
    };
}

Source Code

Source code
pub const Color = enum {
    /// Determine whether stderr is a terminal or not automatically.
    auto,
    /// Assume stderr is not a terminal.
    off,
    /// Assume stderr is a terminal.
    on,

    pub fn get_tty_conf(color: Color) std.io.tty.Config {
        return switch (color) {
            .auto => std.io.tty.detectConfig(std.io.getStdErr()),
            .on => .escape_codes,
            .off => .no_color,
        };
    }

    pub fn renderOptions(color: Color) std.zig.ErrorBundle.RenderOptions {
        return .{
            .ttyconf = get_tty_conf(color),
        };
    }
}