@@ -23,18 +23,18 @@ FUNCTIONS *Vital.Color-functions*
23
23
24
24
parse({str} ) *Vital.Color.parse()*
25
25
Parses various color text formats and creates | Vital.Color-Color-object | .
26
- Supported format is:
27
- * Hex RGB format
28
- * e.g. `#FFF`
29
- * e.g. `#000000 `
30
- * CSS RGB format
31
- * e.g. `rgb (255 ,255 ,255 )`
32
- * e.g. `rgb (100 % ,0 % ,0 % )`
33
- * CSS HSL format
34
- * e.g. `hsl (0 ,50 % ,100 % )`
35
- * `% ` is mandatory
36
- * Color name
37
- * See $VIMRUNTIME/rgb.txt for color names
26
+ Supported format is:
27
+ * Hex RGB format
28
+ * e.g. `#FFF`
29
+ * e.g. `#000000 `
30
+ * CSS RGB format
31
+ * e.g. `rgb (255 ,255 ,255 )`
32
+ * e.g. `rgb (100 % ,0 % ,0 % )`
33
+ * CSS HSL format
34
+ * e.g. `hsl (0 ,50 % ,100 % )`
35
+ * `% ` is mandatory
36
+ * Color name
37
+ * See $VIMRUNTIME/rgb.txt for color names
38
38
>
39
39
let c1 = s:Color.parse('#012')
40
40
let c2 = s:Color.parse('#c0ffee')
@@ -45,21 +45,28 @@ parse({str}) *Vital.Color.parse()*
45
45
<
46
46
rgb({red} , {green} , {blue} ) *Vital.Color.rgb()*
47
47
Creates | Vital.Color-Color-object | with given parameters.
48
+ The value ranges of {red} , {green} , {blue} are 0-255.
48
49
>
49
50
echo s:Color.rgb(0x00, 0x11, 0x22).as_rgb_hex() == '#001122'
50
51
echo s:Color.rgb(0x00, 0x11, 0x22).as_rgb_str() == 'rgb(0,17,34)'
51
52
echo s:Color.rgb(0x00, 0x11, 0x22).as_rgb() == [0.0, 17.0, 34.0]
52
53
<
53
- hsl({red } , {green } , {blue } ) *Vital.Color.hsl()*
54
+ hsl({hue } , {saturation } , {lightness } ) *Vital.Color.hsl()*
54
55
Creates | Vital.Color-Color-object | with given parameters.
56
+ The value ranges are:
57
+ {hue} = 0-360
58
+ {saturation} = 0-100
59
+ {lightness} = 0-100
55
60
>
56
61
echo s:Color.hsl(0, 50, 100).as_hsl_str() == 'hsl(0,50%,100%)'
57
62
echo s:Color.hsl(0, 50, 100).as_hsl() == [0.0, 50.0, 100.0]
58
63
<
59
64
xterm({code} ) *Vital.Color.xterm()*
60
65
Creates | Vital.Color-Color-object | with given parameters.
61
- This converts color name to RGB values internally (so `.as_rgb ()` ,
62
- `.as_rgb_str ()` , `.as_rgb_hex ()` doesn't lose the precision).
66
+ The value range of {code} is 0-255.
67
+
68
+ This converts color name to RGB values internally (so `.as_rgb ()` ,
69
+ `.as_rgb_str ()` , `.as_rgb_hex ()` doesn't lose the precision).
63
70
>
64
71
echo s:Color.xterm(0).as_rgb_hex() == '#000000'
65
72
echo s:Color.xterm(15).as_rgb_hex() == '#FFFFFF'
@@ -70,36 +77,32 @@ COLOR OBJECT *Vital.Color-Color-object*
70
77
*Vital.Color-Color.eq()*
71
78
Color.eq({color} )
72
79
Returns | TRUE | if this object is equal to {color} .
73
- Returns | FALSE | otherwise.
80
+ Returns | FALSE | otherwise.
74
81
75
82
*Vital.Color-Color.distance()*
76
83
Color.distance({color} )
77
84
Returns the distance of 3D vector (r, g, b).
78
85
79
86
*Vital.Color-Color.as_rgb()*
80
87
Color.as_rgb()
81
- Converts this object if necessary, and returns `[r, g, b]` value.
82
- r, g, b are | Float | values.
88
+ Returns `[r, g, b]` value. r, g, b are | Float | values.
83
89
84
90
*Vital.Color-Color.as_rgb_str()*
85
91
Color.as_rgb_str()
86
- Converts this object if necessary, and returns a string like
87
- `rgb ({r },{g },{b })` . r, g, b are | Float | values.
92
+ Returns a string like `rgb ({r },{g },{b })` . r, g, b are | Float | values.
88
93
89
94
*Vital.Color-Color.as_rgb_hex()*
90
95
Color.as_rgb_hex()
91
- Converts this object if necessary, and returns a string like
92
- `#{r }{g }{b }` (e.g. `#000000 ` , always 7 digits).
96
+ Returns a string like `#{r }{g }{b }` (e.g. `#000000 ` , always 7 digits).
93
97
94
98
*Vital.Color-Color.as_hsl()*
95
99
Color.as_hsl()
96
- Converts this object if necessary, and returns `[h, s, l]` value.
97
- h, s, l are | Float | values.
100
+ Returns `[h, s, l]` value. h, s, l are | Float | values.
98
101
99
102
*Vital.Color-Color.as_hsl_str()*
100
103
Color.as_hsl_str()
101
- Converts this object if necessary, and returns a string like
102
- ` hsl ({ h },{ s } % ,{ l } % )` . h, s, l are | Float | values.
104
+ Returns a string like ` hsl ({ h },{ s } % ,{ l } % )` .
105
+ h, s, l are | Float | values.
103
106
104
107
==============================================================================
105
108
TODO *Vital.Color-todo*
@@ -108,4 +111,4 @@ TODO *Vital.Color-todo*
108
111
- Convert color object to the (exact|nearest) terminal code
109
112
110
113
==============================================================================
111
- vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl
114
+ vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl:noet
0 commit comments