mirror of
https://github.com/RGBCube/color.v
synced 2025-07-31 09:57:47 +00:00
rename PaintBrush to Brush
This commit is contained in:
parent
4f435b8f54
commit
3812a606dd
2 changed files with 9 additions and 9 deletions
|
@ -3,11 +3,11 @@ module main
|
|||
import color
|
||||
|
||||
fn main() {
|
||||
p := color.new_brush(
|
||||
brush := color.new_brush(
|
||||
fg: color.rgb(0, 0, 0)!
|
||||
bg: color.hex(0xffffff)!
|
||||
style: [color.bold, color.underline, color.italic]
|
||||
)!
|
||||
|
||||
p.cprintln('Hello World')
|
||||
brush.cprintln('Hello World')
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module color
|
||||
|
||||
[noinit]
|
||||
pub struct PaintBrush {
|
||||
pub struct Brush {
|
||||
pub:
|
||||
fg ?Color
|
||||
bg ?Color
|
||||
|
@ -11,14 +11,14 @@ __global:
|
|||
}
|
||||
|
||||
[params]
|
||||
pub struct PaintBrushParams {
|
||||
pub struct BrushParams {
|
||||
fg ?Color
|
||||
bg ?Color
|
||||
style []Style
|
||||
disabled bool
|
||||
}
|
||||
|
||||
pub fn new_brush(p PaintBrushParams) !PaintBrush {
|
||||
pub fn new_brush(p BrushParams) !Brush {
|
||||
mut count := map[Style]int{}
|
||||
|
||||
for style in p.style {
|
||||
|
@ -29,14 +29,14 @@ pub fn new_brush(p PaintBrushParams) !PaintBrush {
|
|||
}
|
||||
}
|
||||
|
||||
return PaintBrush{
|
||||
return Brush{
|
||||
fg: p.fg
|
||||
bg: p.bg
|
||||
style: p.style
|
||||
}
|
||||
}
|
||||
|
||||
pub fn (p &PaintBrush) render(msg string) string {
|
||||
pub fn (p &Brush) render(msg string) string {
|
||||
if no_color || p.disabled {
|
||||
return msg
|
||||
}
|
||||
|
@ -56,10 +56,10 @@ pub fn (p &PaintBrush) render(msg string) string {
|
|||
return result
|
||||
}
|
||||
|
||||
pub fn (p &PaintBrush) cprint(msg string) {
|
||||
pub fn (p &Brush) cprint(msg string) {
|
||||
print(p.render(msg))
|
||||
}
|
||||
|
||||
pub fn (p &PaintBrush) cprintln(msg string) {
|
||||
pub fn (p &Brush) cprintln(msg string) {
|
||||
println(p.render(msg))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue