owo colors
1.0.0
Uma maneira de custo zero compatível com alocação zero de adicionar cor ao seu terminal de ferrugem para fazer as pessoas irem OWO.
Suportes:
NO_COLOR
/ FORCE_COLOR
set_override
Owo-Colors também é um substituto mais ou menos uma queda para colorido, permitindo que colorido funcione em um ambiente NO_STD. Não são necessárias alocações ou dependências, porque os sistemas incorporados merecem ser muito bem UWU.
Para adicionar à sua carga.toml:
owo-colors = " 3 "
use owo_colors :: OwoColorize ;
fn main ( ) {
// Foreground colors
println ! ( "My number is {:#x}!" , 10 .green ( ) ) ;
// Background colors
println ! ( "My number is not {}!" , 4 .on_red ( ) ) ;
}
use owo_colors :: OwoColorize ;
use owo_colors :: colors :: * ;
fn main ( ) {
// Generically color
println ! ( "My number might be {}!" , 4 .fg::< Black > ( ) .bg::< Yellow > ( ) ) ;
}
use owo_colors :: OwoColorize ;
println ! ( "{}" , "strikethrough" .strikethrough ( ) ) ;
use owo_colors :: { OwoColorize , Stream :: Stdout } ;
println ! (
"{}" ,
"colored blue if a supported terminal"
.if_supports_color ( Stdout , |text| text.bright_blue ( ) )
) ;
Suporta variáveis de ambiente NO_COLOR
/ FORCE_COLOR
, verifica se é um TTY, verifica se está em execução no CI (e, portanto, provavelmente suporta cor) e verifica qual terminal está sendo usado. (Nota: requer o recurso supports-colors
)