1
Fork 0
mirror of https://github.com/RGBCube/color.v synced 2025-08-01 18:37:45 +00:00

Rename cprint* funcs to print*

This commit is contained in:
RGBCube 2022-11-21 21:37:58 +03:00
parent a8949500a3
commit c8b0f02271
4 changed files with 12 additions and 12 deletions

View file

@ -9,9 +9,9 @@ An easier way to print colored text to the terminal.
```v ```v
import color import color
color.red.cprintln('Hello World') color.red.println('Hello World')
color.cyan.cprintln_bg('Hello World') color.cyan.println_bg('Hello World')
color.bold.cprintln('Hello World') color.bold.println('Hello World')
``` ```
## Advanced ## Advanced
@ -25,5 +25,5 @@ brush := color.new_brush(
style: [color.bold, color.underline, color.italic] style: [color.bold, color.underline, color.italic]
)! )!
brush.cprintln('Hello World') brush.println('Hello World')
``` ```

View file

@ -9,11 +9,11 @@ pub interface Color {
render_bg(string) string 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)) 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)) println(c.render_bg(msg))
} }

View file

@ -8,11 +8,11 @@ pub interface Style {
render(string) string render(string) string
} }
pub fn (s Style) cprint(msg string) { pub fn (s Style) print(msg string) {
print(s.render(msg)) print(s.render(msg))
} }
pub fn (s Style) cprintln(msg string) { pub fn (s Style) println(msg string) {
println(s.render(msg)) println(s.render(msg))
} }

8
test.v
View file

@ -3,9 +3,9 @@ module main
import color import color
fn main() { fn main() {
color.red.cprintln('Hello World') color.red.println('Hello World')
color.black.cprintln_bg('Hello World') color.black.println_bg('Hello World')
color.bold.cprintln('Hello World') color.bold.println('Hello World')
brush := color.new_brush( brush := color.new_brush(
fg: color.rgb(0, 0, 0) fg: color.rgb(0, 0, 0)
@ -13,5 +13,5 @@ fn main() {
styles: [color.bold, color.dim, color.italic] styles: [color.bold, color.dim, color.italic]
)! )!
brush.cprintln('Hello World') brush.println('Hello World')
} }