Crates.io | color-output |
lib.rs | color-output |
version | 6.1.4 |
source | src |
created_at | 2024-11-30 00:37:46.671695 |
updated_at | 2024-12-30 03:56:57.978405 |
description | An atomic output library based on Rust that supports output functionalities through functions, builders, and other methods. It allows customization of text and background colors. |
homepage | |
repository | https://github.com/ltpp-universe/color-output |
max_upload_size | |
id | 1466194 |
size | 53,684 |
To install color-output
run cmd:
cargo add color-output
output
Functionuse color_output::*;
output(Output {
text: "test_output_struct",
color: ColorType::Use(Color::Default),
bg_color: ColorType::Color256(0x000000),
endl: true,
..Default::default()
});
output
Methoduse color_output::*;
Output {
text: "test_output_struct_output",
color: ColorType::Use(Color::Default),
bg_color: ColorType::Use(Color::Blue),
endl: true,
..Default::default()
}
.output();
use color_output::*;
OutputList(vec![
Output {
text: "test_output_list_struct_1",
color: ColorType::Use(Color::Default),
bg_color: ColorType::Color256(0x000000),
endl: false,
..Default::default()
},
Output {
text: "test_output_struct_output_2",
color: ColorType::Use(Color::Default),
bg_color: ColorType::Use(Color::Blue),
endl: true,
..Default::default()
},
])
.output();
output
Functionuse color_output::*;
output(
OutputBuilder::new_from(Output::default())
.text("test_output_builder")
.color(ColorType::Color256(0xffffff))
.bg_color(ColorType::Color256(0xffffff))
.blod(true)
.endl(true)
.build(),
);
output
Methoduse color_output::*;
OutputBuilder::new()
.text("test_output_builder_output")
.bg_color(ColorType::Color256(0xffffff))
.color(ColorType::Color256(0xffffff))
.blod(true)
.endl(true)
.build()
.output();
use color_output::*;
OutputListBuilder::new_from(vec![Output::default()])
.add(
OutputBuilder::new()
.text("text")
.bg_color(ColorType::Use(Color::Blue))
.endl(false)
.build(),
)
.add(Output {
text: "test_new_from_output_list_builder_1",
color: ColorType::Use(Color::Default),
bg_color: ColorType::Color256(0x3f3f3f),
endl: false,
..Default::default()
})
.add(Output {
text: "test_new_from_output_list_builder_2",
color: ColorType::Use(Color::Default),
bg_color: ColorType::Use(Color::Cyan),
endl: true,
..Default::default()
})
.run();
use color_output::*;
output_macro!(Output {
text: "test_proc_macro",
color: ColorType::default(),
bg_color: ColorType::Use(Color::Yellow),
endl: true,
..Default::default()
});
use color_output::*;
output_macro!(OutputBuilder::new()
.text("test_output_builder")
.color(ColorType::Use(Color::Cyan))
.blod(true)
.endl(true)
.build());
use color_output::*;
output_macro!(
Output {
text: "test_proc_macro",
color: ColorType::default(),
bg_color: ColorType::Use(Color::Yellow),
endl: true,
..Default::default()
},
OutputBuilder::new()
.text("test_output_builder1")
.color(ColorType::Color256(0xffffff))
.blod(true)
.endl(true)
.build(),
OutputBuilder::new()
.text("test_output_builder2")
.color(ColorType::Color256(0xffffff))
.blod(true)
.endl(true)
.build()
);
ColorType::Use
: Use built-in colors.ColorType::Color256
: Hexadecimal colors.ColorType::Rgb
: RGB color (r, g, b).ColorType::Use(Color::White)
ColorType::Color256(0xffffff)
ColorType::Rgb(255, 255, 255)
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please open an issue or submit a pull request.
For any inquiries, please reach out to the author at ltpp-universe root@ltpp.vip.