class ColorFunctions {

    @ScalarFunction
    @LiteralParameters({"x", "y"})
    @Constraint(variable = "y", expression = "min(2147483647, x + 15)")
    // Color formatting uses 15 characters. Note that if the ansiColorEscape function implementation
    // changes, this value may be invalidated.
    @SqlType("varchar(y)")
    public static Slice render(@SqlType("varchar(x)") Slice value, @SqlType(ColorType.NAME) long color)
    {
        StringBuilder builder = new StringBuilder(value.length());

        // color
        builder.append(ansiColorEscape(color))
                .append(value.toStringUtf8())
                .append(ANSI_RESET);

        return utf8Slice(builder.toString());
    }

    private  ColorFunctions();

}