@@ -12,6 +12,12 @@ function! s:Color.as_rgb_str() abort
12
12
return printf (' rgb(%d,%d,%d)' , r , g , b )
13
13
endfunction
14
14
15
+ function ! s: Color .as_rgb_hex () abort
16
+ let [r , g , b ] = self .as_rgb ()
17
+ let [r , g , b ] = map ([r , g , b ], ' float2nr(round(v:val))' )
18
+ return ' #' . s: _nr2hex (r ) . s: _nr2hex (g ) . s: _nr2hex (b )
19
+ endfunction
20
+
15
21
function ! s: Color .as_hsl_str () abort
16
22
let [h , s , l ] = self .as_hsl ()
17
23
let [h , s , l ] = map ([h , s , l ], ' float2nr(round(v:val))' )
@@ -30,11 +36,6 @@ endfunction
30
36
31
37
let s: RGB = deepcopy (s: Color )
32
38
33
- function ! s: RGB .as_rgb_hex () abort
34
- let [r , g , b ] = map ([self ._r, self ._g, self ._b], ' float2nr(round(v:val))' )
35
- return ' #' . s: _nr2hex (r ) . s: _nr2hex (g ) . s: _nr2hex (b )
36
- endfunction
37
-
38
39
function ! s: RGB .as_rgb () abort
39
40
return [self ._r, self ._g, self ._b]
40
41
endfunction
@@ -45,12 +46,6 @@ endfunction
45
46
46
47
let s: HSL = deepcopy (s: Color )
47
48
48
- function ! s: HSL .as_rgb_hex () abort
49
- let [r , g , b ] = s: _hsl2rgb (self ._h, self ._s, self ._l)
50
- let [r , g , b ] = map ([r , g , b ], ' float2nr(round(v:val))' )
51
- return ' #' . s: _nr2hex (r ) . s: _nr2hex (g ) . s: _nr2hex (b )
52
- endfunction
53
-
54
49
function ! s: HSL .as_rgb () abort
55
50
return s: _hsl2rgb (self ._h, self ._s, self ._l)
56
51
endfunction
0 commit comments