mirror of
https://github.com/RGBCube/color.v
synced 2025-07-30 17:37:45 +00:00
Rename cprint* funcs to print*
This commit is contained in:
parent
a8949500a3
commit
c8b0f02271
4 changed files with 12 additions and 12 deletions
|
@ -9,9 +9,9 @@ An easier way to print colored text to the terminal.
|
|||
```v
|
||||
import color
|
||||
|
||||
color.red.cprintln('Hello World')
|
||||
color.cyan.cprintln_bg('Hello World')
|
||||
color.bold.cprintln('Hello World')
|
||||
color.red.println('Hello World')
|
||||
color.cyan.println_bg('Hello World')
|
||||
color.bold.println('Hello World')
|
||||
```
|
||||
|
||||
## Advanced
|
||||
|
@ -25,5 +25,5 @@ brush := color.new_brush(
|
|||
style: [color.bold, color.underline, color.italic]
|
||||
)!
|
||||
|
||||
brush.cprintln('Hello World')
|
||||
brush.println('Hello World')
|
||||
```
|
||||
|
|
|
@ -9,11 +9,11 @@ pub interface Color {
|
|||
render_bg(string) string
|
||||
}
|
||||
|
||||
pub fn (c Color) cprint_bg(msg string) {
|
||||
pub fn (c Color) print_bg(msg string) {
|
||||
print(c.render_bg(msg))
|
||||
}
|
||||
|
||||
pub fn (c Color) cprintln_bg(msg string) {
|
||||
pub fn (c Color) println_bg(msg string) {
|
||||
println(c.render_bg(msg))
|
||||
}
|
||||
|
||||
|
|
|
@ -8,11 +8,11 @@ pub interface Style {
|
|||
render(string) string
|
||||
}
|
||||
|
||||
pub fn (s Style) cprint(msg string) {
|
||||
pub fn (s Style) print(msg string) {
|
||||
print(s.render(msg))
|
||||
}
|
||||
|
||||
pub fn (s Style) cprintln(msg string) {
|
||||
pub fn (s Style) println(msg string) {
|
||||
println(s.render(msg))
|
||||
}
|
||||
|
||||
|
|
8
test.v
8
test.v
|
@ -3,9 +3,9 @@ module main
|
|||
import color
|
||||
|
||||
fn main() {
|
||||
color.red.cprintln('Hello World')
|
||||
color.black.cprintln_bg('Hello World')
|
||||
color.bold.cprintln('Hello World')
|
||||
color.red.println('Hello World')
|
||||
color.black.println_bg('Hello World')
|
||||
color.bold.println('Hello World')
|
||||
|
||||
brush := color.new_brush(
|
||||
fg: color.rgb(0, 0, 0)
|
||||
|
@ -13,5 +13,5 @@ fn main() {
|
|||
styles: [color.bold, color.dim, color.italic]
|
||||
)!
|
||||
|
||||
brush.cprintln('Hello World')
|
||||
brush.println('Hello World')
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue