From af04d8f92933f1896061ceb5b7fe428f3c9996ff Mon Sep 17 00:00:00 2001 From: RGBCube Date: Sun, 20 Nov 2022 21:16:12 +0300 Subject: [PATCH] Dont use unsupported feature --- color/paintbrush.v | 12 ++++++------ test.v | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/color/paintbrush.v b/color/paintbrush.v index f8c2b43..1a094d9 100644 --- a/color/paintbrush.v +++ b/color/paintbrush.v @@ -9,23 +9,23 @@ mut: } [params] -pub interface BrushParams { - fg ?Color - bg ?Color +pub struct BrushParams { + fg ?Color + bg ?Color styles []Style } pub fn new_brush(p BrushParams) !Brush { - mut style_counter := map[Style]int{} + mut style_counter := map[int]int{} for style in p.styles { if style is Color { return error('A Color was given instead of a Style') } // Style is definitely not a Color - style_counter[style]++ + style_counter[typeof(style).idx]++ - if style_counter[style] > 1 { + if style_counter[typeof(style).idx] > 1 { return error('Multiple of the same style was provided') } } diff --git a/test.v b/test.v index 947aca5..a2e3ebb 100644 --- a/test.v +++ b/test.v @@ -4,13 +4,13 @@ import color fn main() { color.red.cprintln('Hello World') - color.cyan.cprintln_bg('Hello World') + color.black.cprintln_bg('Hello World') color.bold.cprintln('Hello World') brush := color.new_brush( fg: color.rgb(0, 0, 0) bg: color.hex(0xffffff) - style: [color.bold, color.underline, color.italic] + styles: [color.bold, color.dim, color.italic] )! brush.cprintln('Hello World')